I know I've done this before...
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