简体   繁体   English

iPad:无法在拆分视图中设置自定义单元格的背景颜色

[英]iPad: unable to set background color of custom cell in split view

I was trying to set the background color of a customized cell but background color is not displayed. 我试图设置自定义单元格的背景颜色,但不显示背景颜色。

 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]];
}

Is this because of splitview. 这是因为splitview。

尝试使用cell.contentView.backgroundColorcell.backgroundView.backgroundColor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM