ios textView显示html文本

Posted on 2014-11-04 17:29  岁月饶人  阅读(514)  评论(0)    收藏  举报

NSString *content=@"<p>标题</p><p>我是一个小小的测试</p>";

content = [[NSAttributedString alloc] initWithData:[content dataUsingEncoding:NSUnicodeStringEncoding]  options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];

self.contentTextView.attributedText=content;

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3