UILable字体颜色控制
2020-02-16 22:45
357 查看
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"系统详细的使用手册,请点击查看【移动监管用户手册】"]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(14,str.length-1)]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6,12)]; [str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(19,6)]; [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldItalicMT" size:30.0] range:NSMakeRange(0, 5)]; [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"HelveticaNeue-Bold" size:30.0] range:NSMakeRange(6, 12)]; [str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Courier-BoldOblique" size:30.0] range:NSMakeRange(19, 6)]; lbtext.attributedText = str;
转载于:https://www.cnblogs.com/zcw-ios/articles/5035910.html
- 点赞
- 收藏
- 分享
- 文章举报
![](https://g.csdnimg.cn/static/user-reg-year/1x/4.png)
相关文章推荐
- UICollectionViewCell间距
- element-ui的el-select如何不显示value,显示value对应的label值
- Patch for build gmagick on mac osx 10.6(snow leopard)
- logstash-output-jdbc遇到connection is not available,request time out after 10000ms的问题解决
- Cannot convert value '2014-09-15 00:00:00.000000' from column 11 to TIMESTAMP
- Codeforces 803F - Coprime Subsequences(数论)
- Codeforces 846F - Random Query
- 863D - Yet Another Array Queries Problem(思维)
- 【转】NSString+NSMutableString+NSValue+NSAraay用法汇总
- UITableView学习总结
- easyUI—— datagrid 日期比较天数,小时
- UDE-00014: invalid value for parameter, ‘attach’终极解决方案之一
- UI----实现京东首页轮播图
- 爬虫简单笔记——requests基本用法总结
- 爬虫简单笔记——requests高级用法
- PyQuery的用法
- At first sight i have no ideas but i finished it after doing by only one time(Fibonacci sequence)
- keras ctc loss 4000 error: InvalidArgumentError: 修改ignore_longer_outputs_than_inputs=True
- Truth Value Testing
- The method getServletContext is undefined for the type HttpServletRequest