How can I display properly formatted text from an NSString, that just happens to be HTML. The html is coming from the stack overflow API.
+1
A:
You can create a NSAttributedString from HTML. You then draw it as you would draw any other NSAttributedString.
zneak
2010-05-03 02:01:32
Thanks! Works like a charm!
Matt S.
2010-05-03 21:58:58
+1
A:
If your tags are accurate and you are programming for OS X (or iPhone 4.0+), you can use NSAttributedString's – initWithHTML:documentAttributes:, and then draw that directly.
Unfortunately, the iPhone OS' UIKit does not contain NSAttributedString pre-4.0. The current recommendation from the developer docs is to use a UIWebView, which sucks. An alternative might be the Three20 library, which contains TTStyledText -- that looks like it might do the job.
Matt B.
2010-05-03 02:03:02
A:
You could have a WebView, and tell the WebView's mainFrame
to load the HTML string.
If you meant to ask about Cocoa Touch, UIWebView has an equivalent method for you.
Peter Hosey
2010-05-05 05:29:33