Re: Loading RTF Problem
Re: Loading RTF Problem
Subject : Re: Loading RTF Problem
From: Luke Pike <email@hidden >
Date: Wed, 24 Oct 2007 18:12:25 -0400
Delivered-to: email@hidden
Delivered-to: email@hidden
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; bh=Cm/VgpSq9wQfxVaF2r8dT0a1o89F6MoIMRvdkzvdA1I=; b=UjiiIM9nkhum17WhmvTvOpphCsA1WWZ6nUiFOqyTimk+fu4Rn6rjVfbGj7J7P/ijGTPFrMAJtRDNL8MyMQwgeaOq63xxfBXCtzumvixqlRj4CeFs+2t+ATyEOKgpYt0FYDF8D3s66NCZ8t5f2dpidgvlnLlqJVzirp75LXoJS8U=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=QIbK+OErrzC4m/2wrafl31mDsuYyaJrQS8bDsCy6dmI3U0A1bxdbMMW4IH7QS8dAjJ/U2ZMDUrxHmSiEqP6RLODo8yLBGawGwBoE4EteVdT2K8lCrjXMsRuKUG3I3fCtHkidEFselSvJo+pU3u+DVIBPP2hdC8V+smdqT/c8yoM=
On Oct 24, 2007, at 5:51 PM, glenn andreas wrote:
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
Of course! Your exactly right, Glenn. Loading works fine now. Thanks!
_______________________________________________
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
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.