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.
Try to use cell.contentView.backgroundColor
or cell.backgroundView.backgroundColor
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With