UITableView background color

Viewed 28839

I've seen various posts on background color for a UITableView for ios 4.2 but I just cannot seem to change the background color.

UIView *bgView = [[[UIView alloc] init] autorelease];
bgView.backgroundColor = [UIColor blackColor];
bgView.opaque = YES;
self.myTableView.backgroundView = bgView;

I've placed this code in a viewDidLoad but it won't change colors. My UITableView is an IBOutlet inside a UIViewController with a UITableViewDelegate & UITableViewDataSource so I'm thinking at the viewDidLoad the UITableView is already rendered and I cannot change its background color.

EDIT * - the UITableView is grouped

6 Answers
Related