Possible Duplicate:
TTT attributed Label Multi- colored Font help
How can I do like this picture in iphone? Anyone help me. Should I use Core Animation or Text Core or something else? http://s7.postimage.org/qgbhw7c3v/Capture.png
Possible Duplicate:
TTT attributed Label Multi- colored Font help
How can I do like this picture in iphone? Anyone help me. Should I use Core Animation or Text Core or something else? http://s7.postimage.org/qgbhw7c3v/Capture.png
NSString *test = @"How can i Do that? (just only one string and don't devided into 2 part)";
CFStringRef string = (CFStringRef) test;
CFMutableAttributedStringRef attrString = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
CFAttributedStringReplaceString (attrString,CFRangeMake(0, 0), string);
/*
Note: we could have created CFAttributedStringRef which is non mutable, then we would have to give all its
attributes right when we create it. We can change them if we use mutable form of CFAttributeString.
*/
CGColorRef _red=[UIColor redColor].CGColor;
CFAttributedStringSetAttribute(attrString, CFRangeMake(0, 11),kCTForegroundColorAttributeName, _red);
Note => Add CoreText framework in the project and import it.
You can Use OHAtrributedLabel for this easy and effective : https://github.com/AliSoftware/OHAttributedLabel