改变 某段字体的颜色

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;



文/命中注定IU(简书作者)
原文链接:http://www.jianshu.com/p/a370b52e66c8
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。

posted on 2016-12-17 09:52  举个例子yi聪聪  阅读(143)  评论(0编辑  收藏  举报

导航