【发布时间】:2011-05-14 20:55:34
【问题描述】:
实际上,我发现了一些像我一样提出问题的线程。 但是这些线程中给出的每个解决方案都不能在我的代码中使用.. 我读到的最后一个链接是 How to customize the background color of a UITableViewCell?
我的问题是我只想用我自己的颜色更改我的 tableviewcell 背景颜色。 有人可以帮我吗?
【问题讨论】:
-
在 willDisplayCell:forRowAtIndexPath: 中显示您尝试过的代码(包括方法名称和参数的整个方法)。您使用的是 UITableViewCell 还是自定义子类?
-
-(void)tableView:(UITableView )tableView wilLDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ UIView backgroundView = [ [ [ UIView alloc ] initWithFrame :CGRectZero ] 自动释放 ]; backgroundView.backgroundColor = [ UIColor yellowColor ]; cell.backgroundView = 背景视图; for ( UIView* view in cell.contentView.subviews ) { view.backgroundColor = [ UIColor clearColor ]; } //cell.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.5 alpha:1]; }
-
您的代码中有一个拼写错误应该是 willDisplayCell 但在您发布的代码中是 wilLDisplayCell 请检查...
-
thx gyani....我没意识到...谢谢... :)
标签: iphone uitableview background-color