How do you use NSAttributedString?
When building attributed strings, I prefer to use the mutable subclass, just to keep things cleaner. That being said, here’s how you create a tri-color attributed string: NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@”firstsecondthird”]; [string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,5)]; [string addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(5,6)]; [string addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(11,5)]; typed in a browser. caveat implementor Obviously … Read more