if (self.messageModel) {

        NSString * htmlString = self.messageModel.contentText;
NSAttributedString * attrStr1 = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil]; //就这句有用 self.messageTextView.attributedText = attrStr1; if () {
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:@"【重要】"];
[attrStr appendAttributedString:attrStr1];
NSRange range = NSMakeRange(, );
[attrStr addAttribute:NSForegroundColorAttributeName value:GNHGreenColor range:range];
self.messageTextView.attributedText = attrStr;
}
}

显示如下:

最新文章

  1. iOS-appStore发布流程
  2. Unable to get valid context for root
  3. 简单实用的PHP验证码类
  4. synchronized关键字使用剖析
  5. %r与%s的区别
  6. Test-NetConnection
  7. Java批处理操作
  8. PhotoSwipe简介
  9. KingbaseES的DBLink创建
  10. Log POST Data in Nginx
  11. BZOJ 4553 Tjoi2016&Heoi2016 序列
  12. iOS 8 UIAlertController 和 UIAlertAction
  13. mssql sqlserver 将字段null(空值)值替换为指定值的三种方法分享
  14. 04-MirrorGate安装脚本备注
  15. HDU - 1160 (FatMouse's Speed )最长上升子序列
  16. GYM 101173 K.Key Knocking(构造)
  17. Template literals
  18. Linux tomcat
  19. python使用input()来接受字符串时一直报错“xxx is not defined”
  20. TestNG参数

热门文章

  1. Spring泛型依赖注入
  2. solr5.5 基于内置jetty配置 Ubuntu
  3. 【BZOJ】3521: [Poi2014]Salad Bar
  4. 简单说说call 与apply
  5. HDU1010 DFS+剪枝
  6. 【转】ACM博弈知识汇总
  7. ubuntu segmentation fault 段错误
  8. IIS7应用程序池集成和经典的区别
  9. MVC代码中如何调用api接口
  10. PBOC协议中对于所有电子存折/电子钱包应用的预处理