Take the 2-minute tour ×

I have a UITableView cell and I need to set it's label to "Sometext (number)". I can do that, but I need the "(number)" to be grayish, how can I do that? Here's an image which might make what I am trying to ask clearer:

enter image description here

I need the 12, 24, 48, 96 to be gray just like in this picture. Thanks.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

You need two UILabels, You'll have the

label1.textColor = [UIColor blackColor];
label2.textColor = [UIColor grayColor]; 

now then that's the most obvious part, when you set your text on your label1 you'll have to do a

label1.text = ...;
CGSize newsize = [label1.text sizeWithFont:label1.font constraintToSize:CGSizeMake(320, label1.frame.size.height)];
label2.frame = CGRectMake(label1.frame.origin.x + newsize.width + 5., label2.frame.origin.y, label2.frame.size.width, label2.frame.size.height);

so they stay close like they're one label.
share|improve this answer
Hi, thanks for this. –  user635064 Apr 30 '11 at 6:49

you can set text label text color as -

[cellView.textLabel setTextColor:[UIColor grayColor]];
share|improve this answer

Your Answer


