Re: Displaying HTML
Re: Displaying HTML
- Subject: Re: Displaying HTML
- From: Greg Titus <email@hidden>
- Date: Tue, 12 Jun 2001 21:54:42 -0700
On Tuesday, June 12, 2001, at 08:48 PM, Michael P. Rogers wrote:
I'm looking for the equivalent of Java's JEditorPane, something that
will provide an easy way to display HTML. I've written a program that
downloads a page, extracts the parts that I need, but then putting, for
instance "<em>whatever</em>" in an NSTextView, is a bit of a let down.
I can see how this could be done with NSAttributedStrings with a
little work, but is there a better way?
Hi Michael,
Use one of the NSAttributedString additions in AppKit to convert your
HTML into an attributed string:
- initWithHTML:documentAttributes:
- initWithHTML:baseURL:documentAttributes:
Then place the attributed string into your text view with:
[[myTextView textStorage] setAttributedString:myNewAttributedString];
Hope this helps,
--Greg