Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS storyboard: set a background color to prototype cell

I am facing a very strange issue with XCode 4.5.

I tried to set a background color to a prototype cell in my storyboard, but in interface builder the cell color doesn't change, even when I run it on my device it doesn't use the color I set.

I tried creating a subclass of UITableViewCell and setting the color of the background in all init methods but it still donnot work.

PS: XCode 4.5.1 and iOS 5 or 6, same issue. Since I'm a new developer I cannot recall if it worked on previous versions of XCode.

like image 859
dvkch Avatar asked Oct 12 '12 14:10

dvkch


1 Answers

I was able to add a background color to a prototype UITableViewCell inside of a storyboard in Xcode 5.

First, select the cell that you want to give a background color.

Next, goto View -> Utilities -> Identity Inspector and add a new User Defined Runtime Attribute for a Keypath of "backgroundColor" a type of "Color" and a "Value" of whatever color you want.

Screenshot of Identity Inspector panel

like image 195
Nate Flink Avatar answered Sep 18 '22 10:09

Nate Flink