how to set different background colors for cells in a UITableView (specifically rainbow color for seven cells)
If you've subclassed UITableViewCell, you can reliably set self.backgroundColor in -layoutSubviews. At least in my experience, this works in the odd cases where tableView:willDisplayCell:forRowAtIndexPath: does not.
UITableViewCell
self.backgroundColor
-layoutSubviews