• 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
I know I've done this before...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

I know I've done this before...


  • Subject: I know I've done this before...
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 11 Jun 2001 16:51:35 -0700

Here's what I'm trying to do: sender is a textfield that provides an URL. ContentText is an NSTextView in which I want to display the formatted text I've retrieved.

- (IBAction)retrieveURL:(id)sender
{
NSURL *where =
[NSURL URLWithString:[[[sender stringValue] mutableCopy] stringWithPrefix:@"http://"; suffix:@"/"]];
NSAttributedString
*content =
[[NSAttributedString alloc]
initWithHTML:[NSData dataWithContentsOfURL:where]
documentAttributes:nil];
[ContentText selectAll:nil];
[ContentText insertText:content]; // <- this is NOT working.
}

I know I've done this before, but I don't recall how to insert an NSAttributedString into an NSTextView, preserving its formatting. Do I have to stick it in the pasteboard first?

-jcr


"The problem with trying to child-proof the world, is that it makes people neglect the far more important task of world-proofing the child." -- Hugh Daniel


  • Follow-Ups:
    • Re: I know I've done this before...
      • From: Scott Anguish <email@hidden>
    • Re: I know I've done this before...
      • From: David P Henderson <email@hidden>
    • Re: I know I've done this before...
      • From: Cliff Crawford <email@hidden>
    • Re: I know I've done this before...
      • From: Greg Titus <email@hidden>
  • Prev by Date: Image zoom in capability
  • Next by Date: Re: Cocoa Calling Carbon Question
  • Previous by thread: Aliases, UFS, and cocoa
  • Next by thread: Re: I know I've done this before...
  • Index(es):
    • Date
    • Thread