ios - Different colors in UITextView -
i seek add together string different colors in uitextview. wrote code
nsmutableattributedstring* attstring = [[nsmutableattributedstring alloc]initwithstring:view.text]; //view uitextview [attstring addattribute:(nsstring*)kctforegroundcolorattributename value:[uicolor greencolor] range:(nsrange){attstring.length-8, 8}]; view.attributedtext = attstring;
maybe wrong attribute, can tell me attribute alter color text?
try using nsforegroundcolorattributename
instead of kctforegroundcolorattributename
.
nsattributedstring uikit additions reference: character attributes
ios objective-c cocoa-touch nsstring
No comments:
Post a Comment