milanjansari milanjansari - 2 years ago 175
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download