使用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;

posted @ 2015-12-09 10:06  iOS_XL_NSArray  阅读(331)  评论(0编辑  收藏  举报