Quirk of the day - UITableView background color

Much as I love the Apple developer documentation, there seem to be any number of detailed behaviours that are not document and cause a lot of frustration and lost time. This is the first of series of short posts documenting some that I have found.

If you want to set the background color of a UITableView you also need to set the background view to nil. Just setting the background color has no visible impact. This is certainly the case when using a UITableViewController, and I assume would also be the case if you roll your own.

So you want:

[[self tableView] setBackgroundView:nil];

[[self tableView] setBackgroundColor:[UIColor someColor]];

Happy coding.