Reputation: 4339
I've set the colour of my UITableViewCell as follows:
UIColor *RedCell = [UIColor colorWithRed:(199/255.0) green:(0/255.0) blue:(39/255.0) alpha:0.2];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.contentView.backgroundColor = RedCell;
However, you can see in the screenshot that it is creeping outside the border of the cell. What's the appropriate way to set the background so this doesn't happen?
Upvotes: 0
Views: 45
Reputation: 1742
try cell.backgroundColor, as per the docs
You shouldnt modify the contentView, exceptz to add subviews to it. For a full understanding of how TableViews work, read the provided link. Trust me, it is worth your time.
Upvotes: 0
Reputation: 33421
For grouped tableview cells, you should set the background color on the background view, instead of the content view (which I assume is a clear background).
Upvotes: 2