2016-05-23 3 views

Antwort

2

Sie können Farbe in h3-Tag wie auf diese Weise anwenden

let htmlString: String = "<html><body> <h3><font color=black>Some html string</font></h3> </body></html>" 

let temphtmlString : NSString = (htmlString as NSString).stringByReplacingOccurrencesOfString("color=black", withString: "color=blue") 


    let attrStr = try! NSAttributedString(
       data: temphtmlString.dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true)!, 
       options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType], 
       documentAttributes: nil) 
txtView.attributedText = attrStr 
+0

HTML-String wird vom Server und die Überschrift Tag Farbe kommt, ist schwarz sie. –

+0

Sie können HTML String mit ** StringByReplacingOccurrencesOfString ersetzen ** – Bhumi

+0

können Sie es in Ihrem Code verwenden –