• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying HTML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Displaying HTML (From: "Michael P. Rogers" <email@hidden>)

  • Prev by Date: Re: FAQ (Re: Cocoa Calling Carbon Question)
  • Next by Date: Re: Cocoa/EOF for non-enterprise apps Re: proof of cocoa superiority?
  • Previous by thread: Displaying HTML
  • Next by thread: IB key-value oddity...
  • Index(es):
    • Date
    • Thread