iOS 使用UILabel展示H5文本信息

     self.contentStr  =  “h5文本”

     let data = self.contentStr.dataUsingEncoding(NSUnicodeStringEncoding)

        do {

            let attrStr = try NSAttributedString(data: data!, options: [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType], documentAttributes: nil)

            webView.attributedText = attrStr

        } catch let error as NSError{

            print("error:\(error)")

        }


你可能感兴趣的:(label,webView,swift,iOS)