IPhoneForegroundColorAttributeName Button on iPhone

I heard that the NSAttributedString is being added to the iPhone, but when I use the NSForegroundColorAttributeName key to set the color, I get the error "NSForegroundColorAttributeName uneclared". Did I miss something? Please help me.

respectfully

Yallappa

+4
source share
2 answers

Try using kCTForegroundColorAttributeName instead.

+9
source

I came across the same question as BarretJ, indicating that you are using the constant kCTForegroundColorAttributeName. Here is an example:

NSMutableAttributedString* attrStr = [[NSMutableAttributedString alloc] initWithString:countStr attributes:nil]; [attrStr addAttribute:(NSString*)kCTForegroundColorAttributeName value:(id)[[UIColor greenColor] CGColor] range:range]; 
+11
source

All Articles