let str = "Html文本"
var content = UILabel()
guard let news = str.removingPercentEncoding,let data = news.data(using: .unicode) else{return}
let att = [NSAttributedString.DocumentReadingOptionKey.documentType:NSAttributedString.DocumentType.html]
guard let attStr = try? NSMutableAttributedString(data: data, options: att, documentAttributes: nil) else{return}
content.attributedText = attStr
网友评论