Altering the background color of cell.accessoryView and cell.editingAccessoryView

Upon reading the documentation (a novel idea), I found the article, “A Closer Look at Table-View Cells”. It helped me understand the composition of the cells, and I found my answer…

cells look like this…

alt text

Since the cell.accessoryView is a sister view to cell.contentView I had to ask the cell.contentView for its superview, and then I was able to change the background color for both views at once. Here’s what the code looks like…

// Cell Formatting
cell.contentView.superview.backgroundColor = [UIColor greenColor];

I know it’s really simple, but I’m a newbie and it took me ages to slow down and read the doc. Hopefully, this helps some other folks out there!

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)