milanjansari milanjansari - 4 months ago 23x
iOS Question

Display html text in uitextview

How can I display HTML text in textview?

For example,

string <h1>Krupal testing <span style="font-weight:
bold;">Customer WYWO</span></h1>

Suppose text is bold so it display in textview as bold string
but I want display normal text. Is this possible in the iPhone SDK?


Use a UIWebView on iOS 5-.

On iOS 6+ you can use UITextView.attributedString, see for how.

There's also an undocumented -[UITextView setContentToHTMLString:] method. Do not use this if you want to submit to AppStore.