Change the background of a UITableView on the iPad
For some reason, the iPad version of a UITableView doesn't respond to this:
self.tableView.backgroundColor = [UIColor redColor];
Run it on an iPhone and the table background will be red. Run it on an iPad and the background property will not have changed.
Here's how to get around this:
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
[self.tableView setBackgroundView:nil];
[self.tableView setBackgroundView:[[UIView alloc] init]];
}
self.tableView.backgroundColor = [UIColor redColor];
Written by Mark Rickert
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ios
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#