Static UITableViewCell backgroundColor is always white on iPad

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

However, on iPad, the background with cells is always white.

I found a solution for dynamic cells here , but since it uses the UITableViewDataSource protocol, I cannot use it with my static table.

How can I solve this problem?

+3


source to share


2 answers


You must install cell.contentView.backgroundColor

as @SandeepAggarwal pointed out.



+5


source


- (void)tableView:(UITableView *)tableView
  willDisplayCell:(UITableViewCell *)cell
forRowAtIndexPath:(NSIndexPath *)indexPath
{
  [cell setBackgroundColor:[UIColor clearColor]];
}

      



try this it will solve your problem

0


source







All Articles