• 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: Loading RTF Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Loading RTF Problem
      • From: Luke Pike <email@hidden>
References: 
 >Loading RTF Problem (From: Luke Pike <email@hidden>)

  • Prev by Date: Loading RTF Problem
  • Next by Date: Re: Unwanted cursor
  • Previous by thread: Loading RTF Problem
  • Next by thread: Re: Loading RTF Problem
  • Index(es):
    • Date
    • Thread