< Back

# iOS 7 UITableViewCells and their backgroundColor

Today I simply wanted to change my UITableViewCell’s backgroundColor (in fact I did so using InterfaceBuilder) and didn’t believe my eyes… nothing happened.

A closer look into UITableViewCell Class reference states this:

... In iOS 7, cells have a white background by default; in earlier versions of iOS, cells inherit the background color of the enclosing table view. If you want to change the background color of a cell, do so in the tableView:willDisplayCell:forRowAtIndexPath: method of your table view delegate.

Nothing special though I thought, but there seems to be a bug in Xcode 5 which leads to the color not beeing used.

While setting the color in the tableView:willDisplayCell:forRowAtIndexPath: method definately works, this is a bit ugly as I’m, most of the time, relying on my Storyboard.

Impressum • Mastodon • Bluesky