美文网首页
Swift加载Html文本

Swift加载Html文本

作者: Distance先生 | 来源:发表于2020-06-01 10:39 被阅读0次
          let str = "Html文本"
          var content = UILabel()
          guard let news = str.removingPercentEncoding,let data = news.data(using: .unicode) else{return}
          let att = [NSAttributedString.DocumentReadingOptionKey.documentType:NSAttributedString.DocumentType.html]
          guard let attStr = try? NSMutableAttributedString(data: data, options: att, documentAttributes: nil) else{return}
          content.attributedText = attStr
    

    相关文章

      网友评论

          本文标题:Swift加载Html文本

          本文链接:https://www.haomeiwen.com/subject/ohjjzhtx.html