字符串部分变色

NSMutableAttributedString *attriString = [[NSMutableAttributedString alloc] initWithString:desc];

[attriString addAttribute:NSForegroundColorAttributeName

value:[UIColor colorWithRed:126/255.0 green:62/255.0 blue:66/255.0 alpha:1.0]

range:[desc rangeOfString:@"干扰"]];

_skillDescriptionLabel.attributedText=attriString;

你可能感兴趣的:(字符串部分变色)