3

In my project, I have a static TableView. I changed the backgroundColor of the cells in interface builder. This shows correctly on iPhone.

However, on iPad the cells background is always white.

I found a solution for dynamic cells here, but as it is using the UITableViewDataSource protocol, i can't use it with my static table.

How could I solve this problem?

Community
  • 1
  • 1
mattti
  • 53
  • 5

2 Answers2

5

You should set the cell.contentView.backgroundColor, as @SandeepAggarwal has pointed out.

eschanet
  • 1,063
  • 6
  • 15
  • That was the obvious part to me. However you answered my question correctly, so I will accept the answer. My real problem was, how to access the static UITableViewCells. [This](http://stackoverflow.com/a/15277305/4147323) pointed me in the right direction. – mattti Jul 12 '15 at 08:23
0
- (void)tableView:(UITableView *)tableView
  willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
  [cell setBackgroundColor:[UIColor clearColor]];
}

try this , it will solve your problem

Vatsal Raval
  • 311
  • 1
  • 9