I'm trying to change a UILabels first line's color. It's not working for some reason. Here is my code:
NSMutableAttributedString *text = 
 [[NSMutableAttributedString alloc] 
   initWithAttributedString: label.attributedText];
[text addAttribute:NSForegroundColorAttributeName 
             value:[UIColor redColor] 
             range:[label.text rangeOfString:@"\n"];];
[label setAttributedText: text];
I don't see any changes in the first line.
                        
The problem is here
It will color only
\nYou need range from
0to start of\nEdit : You can try this code (it's not tested but should work)