iOS 字符串局部改变颜色
2016-04-28 本文已影响3459人
命中注定IU
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;