我试着用不同的颜色在我的UITextView添加字符串。 我写了这个代码
NSMutableAttributedString* attString =
[[NSMutableAttributedString alloc]initWithString:view.text]; //view is my UITextView
[attString addAttribute:(NSString*)kCTForegroundColorAttributeName
value:[UIColor greenColor]
range:(NSRange){attString.length-8, 8}];
view.attributedText = attString;
也许是不正确的属性,你能告诉我什么属性改变颜色的文字?