I'm working on a project. I have plenty of UITableView
s which are set as clear color. Their views' background color are set to my custom color and everything is fine on iPhone.
The issue comes up on iPad! I tried almost everything, but my UITableView
has a white color.
I checked the other topics, like: UITableView backgroundColor always gray on iPad, but nothing worked. Also, my problem is not grey, it's white as snow!
What might be the reason of it?
SWIFT I had this problem too. Works fine on .phone but tableViewCells go white on .pad. Thought I'd show how I fixed it using swift.
Connect The tableViewCell to the viewController.swift as an @IBOutlet like so:
Then in viewDidLoad put the following:
Very strange, I don't know whats happening here but this solved it for me.
Good News: According to the release notes, for iOS 10:
For versions <10:
I was seeing this in iOS 8 (8.3). Even though in IB my cells were "clear color" and their content views were "clear color" they would render as white. An imperfect but reasonable solution, since it still takes values from IB:
It seems that my dequeued reuseable cells get their background forced to white on iPad. I was able to determine this using the view hierarchy debugger.
Once I did this I was able to use the table's background color and didn't have to set a background view, although that works as well.
I just had this issue and fixed it by changing the backgroundColor of the View (as opposed to the one of the tableView). Seems on iPad, that's the one that is used first and in my case it was set to white.
I have a table view with many different cells inside, each one has different color.
The answer from @Ben Flynn
cell.backgroundColor = self.contentView.backgroundColor
can not achieve that. The reason isself.contentView.backgroundColor
is nil, so what you did is just clear thecell.backgroundColor = nil
.Basically it is the bug from Xcode (I think, yeah it sucks!),
cell.backgroundColor
still has color, but it can not display.After debug for a while, based on @Ray W answer, here is my solution.