views:

401

answers:

1

Hello, my question is simple....

How to get rid of the white background color of cells in Group Style.

I know about clearColor but it just clears the background color of the tableview itself and not the background color of cells.

Thanks in advance.

A: 

The UITableViewCell class has a backgroundView property. This is typically set to nil for normal-stye table views, but for grouped table views it isn't. Try this:

if ([ cell backgroundView] != nil ) {
    [[cell backgroundView] setBackgroundColor:[UIColor redColor]];
} else {
    // Create a view, set its frame to the cell's frame, and set its background
    // color.
}

That code will set the cell's background color to red if it's in a grouped table view.

Jeff Kelley
Well the first part didn't work. So I removed the if statement and the "else" part worked like a charm.Thanks a lot.
looneygrc