views:

2288

answers:

3

Just want to make sure I'm not overlooking something obvious... It seems like it should be trivial to set the background color (black is fine) of a UITableView's cell to something other than white or completely transparent so that you can display your data with white text. However, with my attempts I lose the corners on my grouped table view and it all looks like crap.

I've seen & understand the methods described by Matt Gallagher about customizing TableView cells with exotic gradients, etc. but wanted to be certain before heading down that path...

A: 

I believe that the rounded corners of the Grouped style are actually backgrounds of the table cells. Thus you can't just replace the white part, because it's not solid color with drawn border - it's ImageView acting as backgroundView for the cell (using different graphics depending of the cell row and number of rows in section).

So either you try with your own graphics so you can keep the roundness (I'm trying something out for myself, not fully figured yet) or set each cell.backgroundView to nil and use cell.backgroundColor = [UIColor blackColor];

Aleksandar Vacic
A: 

If you edit the cell.backgroundColor instead of the cell.contentView.backgroundColor it should work for you.

Zak