改变输入字符串的颜色

strStaus = [晴]

NSString *str = [NSString stringWithFormat:@"天气:%@  ",,strStaus];

NSMutableAttributedString *attrDescribeStr = [[NSMutableAttributedString alloc] initWithString:str];

[attrDescribeStr addAttribute:NSForegroundColorAttributeName

value:[UIColor orangeColor]

range:[str rangeOfString:strStaus]];

self.myNameLable.attributedText = attrDescribeStr;



转自  链接:https://www.jianshu.com/p/a370b52e66c8

你可能感兴趣的:(改变输入字符串的颜色)