UITableView Cell background color not changing?
I have a UITableView created in two storyboards - one for the iPhone and one for the iPad.
I set it up in the iPhone storyboard in such a way that the cells have a clear background and so the background image shows - it works great.
HOWEVER, when I copy this view into an iPad storyboard, for some reason the table cells have a white background even though all the settings are the same (a clear color still set in the builder).
What could be causing this?
EDIT - I looked at this further, and if I changed the color of the line to anything it doesn't change - it stays white for some reason: /
source to share
There is a known issue with this and the fix is ββto add the following to the .m file for your class:
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
[cell setBackgroundColor:[UIColor clearColor]];
}
source to share
From iOS 7, UITableViewCell has a white background by default.
Install: cell.contentView.backgroundColor = [UIColor clearColor];
and ultimately:cell.contentView.backgroundView = nil;
And confirm yours as well:
tableview.backgroundColor = [UIColor clearColor];
tableview.backgroundView = nil;
source to share