有时可能会遇到这样的问题,一个label中设置的文本含有2种以上不同的格式,又不能把它拆解为两个label来显示,这时用NSMutableAttributedString可以很好的解决问题。

示例如下:

NSMutableAttributedString*text =[[NSMutableAttributedString alloc] initWithAttributedString: label.attributedText];[text addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(10,1)];[label setAttributedText: text];

最新文章

  1. 怎么让网站在本地支持SSL?
  2. 美国usan数据库——PDF提取
  3. 使用CSS完美实现垂直居中的方法
  4. 在Ubuntu搭建.NET Core环境
  5. [BS-28] iOS中分页的几种算法
  6. Android开发之火星坐标转换工具
  7. 《JSON必知必会》
  8. Vim的撤销与重做
  9. POJ 1704 Georgia and Bob (Nim游戏变形)
  10. Java---IO加强(2)
  11. ShellSort Shell排序
  12. [PHP] 编译构建最新版PHP源码
  13. CentOS 7.4上安装mysql 8.0
  14. ionic 视图滚动到顶部
  15. 组织安全性SQL
  16. yield的表达式形式的应用(待补充)
  17. MyBatis 学习记录2 Mapper对象是如何生成的
  18. 编写高质量代码改善C#程序的157个建议——建议124:考虑在命名空间中使用复数
  19. JavaScript关键字return的用法
  20. JSP Tomcat8.0运行连接池时发生异常【AbstractMethodError oracle.jdbc.driver.T4CConnection.isValid(I)Z】

热门文章

  1. SQL Server 索引结构及其使用(一)
  2. 安装java memcached client到本地maven repository
  3. Android 设置按钮为透明
  4. 【HDOJ】4210 Su-domino-ku
  5. ERP 及相关名词的含义
  6. layer父页面刷新
  7. bzoj1027
  8. C#程序中访问配置文件
  9. log4net面面观之Repository
  10. CSS+DIV之强化background属性