一. 修改NSString字符串中某段字符串的顏色
NSMutableAttributedString *totalContentAttributedStr = [[NSMutableAttributedString alloc] initWithString: resultStr];
UIColor *highLightColor = COLOR_RED;
[totalContentAttributedStr setAttributes:@{NSForegroundColorAttributeName : highLightColor, NSFontAttributeName : [AdaptiveClass ultimateEditionBySize:17 isBlod:NO]} range:NSMakeRange(firstItemStr.length, keyStr.length)];
self.contentLabel.attributedText = totalContentAttributedStr;
NSAttributedString,NSMutableAttributedString是帶屬性的特殊字符串畜埋,NSMutableParagraphStyle是帶屬性的文本段落屬性,用于控制段落有關(guān)屬性
**1辩撑、NSAttributedString **
參考