我有这个代码
[label setText:@"ddddasdasdas" afterInheritingLabelAttributesAndConfiguringWithBlock:^ NSMutableAttributedString *(NSMutableAttributedString *mutableAttributedString) {
[mutableAttributedString addAttribute:(NSString*)kCTForegroundColorAttributeName value:(id)[UIColor blackColor] range:NSMakeRange(0,1)];
[mutableAttributedString addAttribute:(NSString*)kCTForegroundColorAttributeName value:(id)[UIColor redColor] range:NSMakeRange(2,3)];
[mutableAttributedString addAttribute:(NSString*)kCTForegroundColorAttributeName value:(id)[UIColor greenColor] range:NSMakeRange(5,2)];
return mutableAttributedString;}];
并且只有第一个字符改变颜色,但其余文本没有改变。有任何想法吗?