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) {
开发者_如何学JAVA 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.
Try to use cell.contentView.backgroundColor
or cell.backgroundView.backgroundColor
instead.
精彩评论