There is a line: @ "show student counts,
who pass the exams "; How to show this line in UITextView or in what, so that the formatting is displayed in accordance with the encountered html-tags?
- What version of ios? - HasmikGaryaka
|
1 answer
The answer is from English so. Ios 7+.
NSString *htmlString = @"<h1>Header</h1><h2>Subheader</h2><p>Some <em>text</em></p><img src='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; - Thank you very much! - Ivan Kushiju
- It should be noted that this function is rather slow, which I encountered myself (and not only me robpeck.com/2015/04/nshtmltextdocumenttype-is-slow/… ). As an option to use the proposed link library
DTCoreText. - schmidt9
|