سؤال

How to style the text of a UITableViewCell using Three20 TTStyledTextLabel ? I tried :

TTStyledTextLabel* label = [[[TTStyledTextLabel alloc] initWithFrame:CGRectMake(0, 0, 300, 60)] autorelease];

NSInteger i = ...;
NSString *s =  [NSString stringWithFormat:@"%@ <font color='red'>(%d)</font>", [dic objectForKey:@"name"], i];

label.text = [TTStyledText textFromXHTML:s lineBreaks:NO URLs:NO];

[cell.textLabel addSubview:label];

but the cell just keeps blank. Any idea?

هل كانت مفيدة؟

المحلول

You need to specify a frame for that label. Otherwise it's CGRectZero.

Hope this helps.

Cheers!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top