![](/img/trans.png)
[英]Unable to change background color of static table view cell on iOS 7 (iPad)
[英]iPad: unable to set background color of custom cell in split view
我試圖設置自定義單元格的背景顏色,但不顯示背景顏色。
ProjectListCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[ProjectListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
if((indexPath.row%2)!=0)
{
[cell setBackgroundColor:[UIColor redColor]];
}
else
{
[cell setBackgroundColor:[UIColor greenColor]];
}
這是因為splitview。
嘗試使用cell.contentView.backgroundColor
或cell.backgroundView.backgroundColor
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.