Skip to content

swift UILabel不显示html标签

Published: at 11:55 AM | 1 min read

带html标签的文本srcText

var attrStr = NSAttributedString(data: srcText.dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true)!, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], documentAttributes: nil, error: nil)

label.attributedText = attrStr