我找到了方法.我做的Info.plist
应用程序传输安全设置 - >允许任意加载 - >是
图像正在显示.
和代码:
DispatchQueue.main.async {
let attrStr = try! NSAttributedString(
data: (self.detailLabelText?.data(using: String.Encoding.unicode, allowLossyConversion: true)!)!,
options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
documentAttributes: nil)
self.detailLabel.attributedText = attrStr
self.detailLabel.textAlignment = NSTextAlignment.justified
self.detailLabel.contentMode = .scaleToFill
self.detailLabel.font = UIFont(name: "PTSans-Narrow", size: 18.0)
}
detailLabel.adjustsFontSizeToFitWidth = true
detailLabel.sizeToFit()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6434 次 |
| 最近记录: |