BackgroundColor shortcuts UITableViewCellStyleSubtitle?

I am trying to create a table with an image as a background. To do this, I started with the background:

self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];

The result is a background image that also appears in the table cells. This is not what I want, so I tried setting the backgroundColor cell:

cell.backgroundColor = [UIColor whiteColor];

It had no effect !!! Hmm, strange. So I tried this:

UIView *backgroundView = [[UIView alloc] init];
backgroundView.backgroundColor = [UIColor whiteColor];
cell.backgroundView = backgroundView;
[backgroundView release];

It almost works. The only problem that remains is that textLabel and detailTextLabel still display the background behind them. Setting backgroundColor on these labels to white also does nothing.

How do I proceed? Where am I mistaken? I am trying to achieve a tableView as a worldClock application.

+2
source share
1 answer

, tableView:willDisplayCell:forRowAtIndexPath:, tableView:cellForRowAtIndexPath: , :

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
    cell.backgroundColor = [UIColor whiteColor];
}
+10

All Articles