码迷,mamicode.com
首页 > 其他好文 > 详细

改变Label中不同位置的字的颜色

时间:2014-05-16 07:00:18      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:blog   class   code   c   ext   color   

1
2
3
4
5
6
//取出想要变得字符串在大字符串的什么地方
    NSRange changeRange = [chapterStr rangeOfString:totalImg];
    //字显示不同的颜色
    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc]initWithString:chapterStr];
    [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:0.6 alpha:1] range:changeRange];
    [cell.nameLable setAttributedText:attributedStr];

 

改变Label中不同位置的字的颜色,布布扣,bubuko.com

改变Label中不同位置的字的颜色

标签:blog   class   code   c   ext   color   

原文地址:http://www.cnblogs.com/lxllanou/p/3726213.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!