使用label解析html字符串

NSString *strHtml = @"<b>提示</b><br/>1、测试测试测试测试测试测试测试测试测试测试测试测试<br/>2、测试测试测试测试测试测试测试测试测试测试";

 NSAttributedString * strAtt = [[NSAttributedString alloc] initWithData:

[strHtml dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];

 self.labelContent.attributedText = strAtt;

 self.textViewContent.attributedText = strAtt;

原文地址:https://www.cnblogs.com/dbaiyunyun/p/5031950.html