1
我有一個textView來設置文章(富HTML文本)的內容。UITextView HTML爲圖像應用響應式CSS
static func setTextViewRichText(textView: UITextView, html: String) {
do{
let attributedText = try NSAttributedString(data: html.dataUsingEncoding(NSUTF8StringEncoding)!, options: [NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute: NSNumber(unsignedLong: NSUTF8StringEncoding)], documentAttributes: nil)
textView.attributedText = attributedText
} catch let err as NSError {
NSLog("%s", err)
textView.text = html
}
}
html字符串從我的網站下載。我將全球範圍內的.img-responsive
課程應用於所有圖片(twitter bootstrap)。如何申請這個類(或類似的響應樣式我UITextView
?
我可以申請bootstrap.min.css @約翰 –