Göktuğ Aral Göktuğ Aral - 5 months ago 23
Objective-C Question

UITableView backgroundColor always white on iPad

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?

Answer

Instead of setting the background color, trying using a background view instead, like this:

- (void)viewDidLoad {
    self.tableView.backgroundView = [UIView new];
    self.tableView.backgroundView.backgroundColor = [UIColor clearColor];
}

I've had problems where using the backgroundColor doesn't always have an effect, but setting a background view instead works fine.

Comments