Re: Loading RTF Problem
Re: Loading RTF Problem
- Subject: Re: Loading RTF Problem
- From: glenn andreas <email@hidden>
- Date: Wed, 24 Oct 2007 16:51:21 -0500
On Oct 24, 2007, at 4:38 PM, Luke Pike wrote:
Hi everybody.
I know this has been asked before, but I could not find any clear
answers on the list or anything that worked.
I'm using the standard NSDocument methods for saving and loading.
Saving works fine, as I can open it up in TextEdit. However, it
won't load it back into my textview. Here is the code from
MyDocument.m.
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
return [textView RTFFromRange:NSMakeRange(0, [[textView string]
length])];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
[textView replaceCharactersInRange:NSMakeRange(0, [[textView
string] length]) withRTF:data];
return YES;
}
Again, saving works fine. Loading doesn't. Can some tell me why
this won't work? Thanks.
- Luke
Most likely because loadDataRepresentation is called before your
window (and thus "textView") is loaded.
You can load the value for your textView in windowControlDidLoad:
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium2 | build, mutate, evolve, animate | images, textures,
fractals, art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden