首页 > 代码库 > iOS UITextView 展示html

iOS UITextView 展示html

NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p><img src=http://www.mamicode.com/‘http://blogs.babble.com/famecrawler/files/2010/11/mickey_mouse-1097.jpg‘ width=70 height=100 />";    NSAttributedString *attributedString = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];textView.attributedText = attributedString;

 

iOS UITextView 展示html