The answer came up to me from BHUPI.
Code transfer is quick, as shown below:
Note "allowLossyConversion: false"
if you set to true, it will display clear text.
let theString = "<h1>H1 title</h1><b>Logo</b><img src='http://www.aver.com/Images/Shared/logo-color.png'><br>~end~" let theAttributedString = try! NSAttributedString(data: theString.dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil) UITextView_Message.attributedText = theAttributedString
米米米 Oct 07 '15 at 9:50 2015-10-07 09:50
source share