带html标签的文本srcText
var attrStr = NSAttributedString(data: srcText.dataUsingEncoding(NSUnicodeStringEncoding,allowLossyConversion: true)!,options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],documentAttributes: nil,error: nil)label.attributedText = attrStr 原文链接:https://www.f2er.com/swift/326483.html