swift label 显示html文本
作者:
晨煜煌 | 来源:发表于
2019-04-10 15:45 被阅读0次let html = "htmlText: <font color='#FF8B2F'>111111</font>"
do {
if let data = html.data(using: String.Encoding.unicode, allowLossyConversion: true) {
let attStr = try NSAttributedString.init(data: data, options: [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html,], documentAttributes: nil)
titleLabel.attributedText = attStr
}
} catch {
titleLabel.text = html
}
本文标题:swift label 显示html文本
本文链接:https://www.haomeiwen.com/subject/xptoiqtx.html
网友评论