如何快速显示图像

时间:2018-10-15 11:04:17

标签: html ios swift4

想象一下我有这个json: enter image description here

我可以将Json转换为字符串并通过以下代码显示它:

extension String {
    var htmlToAttributedString: NSAttributedString? {
        guard let data = data(using: .utf8) else { return NSAttributedString() }
        do {
            return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)
        } catch {
            return NSAttributedString()
        }
    }
    var htmlToString: String {
        return htmlToAttributedString?.string ?? ""
    }
}

但是我无法在json中显示图片。我该怎么办?

0 个答案:

没有答案