Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Cell Text Color

Apparently this is deprecated :

cell.textColor = [UIColor whiteColor];

Does anyone know what the best way to change the color of a Cell Text ?


Edit after comment :

I'm now using this :

cell.textLabel.textColor = [UIColor whiteColor];

but the color is still not changing, see the IB parameters :

alt text

like image 271
Finger twist Avatar asked Sep 25 '10 21:09

Finger twist


2 Answers

cell.textLabel.textColor = [UIColor whiteColor];

like image 170
knuku Avatar answered Sep 30 '22 05:09

knuku


Like says Apple on the UITableViewCell page http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html

The color of the title text. (Deprecated in iOS 3.0. Instead set the text color attribute of the UILabel objects assigned to the textLabel and detailTextLabel properties.)

You must use the textLabel instead textColor ;-)

Edit : you must add your OWN textLabel. You must forget cell.text

like image 24
Vinzius Avatar answered Sep 30 '22 05:09

Vinzius