小编Jor*_*ray的帖子

Does NSHTMLTextDocumentType support HTML table?

In my app, i want to display a text in a UILabel. I use HTML to store the text in my data base to dynamically from my text in my app. I actually use this (Swift 3.2, iOS 8+) :

if let data = text.data(using: .utf8) {
    let htmlString = try? NSMutableAttributedString(data: data, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: String.Encoding.utf8.rawValue], documentAttributes: nil)

    self.textLabel.attributedText = htmlString

}
Run Code Online (Sandbox Code Playgroud)

It's work great for the HTML stuff i used like

<b>Text</b>
<i>Test</i>
And more...
Run Code Online (Sandbox Code Playgroud)

Now, i …

html html-table uilabel ios swift

3
推荐指数
1
解决办法
1025
查看次数

标签 统计

html ×1

html-table ×1

ios ×1

swift ×1

uilabel ×1