• 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
Really struggling with Saving in NSDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Really struggling with Saving in NSDocument


  • Subject: Really struggling with Saving in NSDocument
  • From: Ian Jackson <email@hidden>
  • Date: Tue, 26 Jul 2005 21:37:40 +1200

Hi All,

How's it going? I've been battling away for weeks now, trying to save a NSMutableArray of my objects (graphic). The useful part of my graphic class is an NSBezierPath.
The array is owned by MyDocument, and my graphic objects are created in a class I wrote, which just creates the objects and puts them in the array (it does this in response to mouse clicks in the view) (supposed to be the controller). So I did the keyed archiving for the paths in my graphic objects, and the Tiger style saving method in MyDocument. It appears to save fine, but when I open the file that's created, the paths are no longer paths. The debugger shows that the path has crazy numbers associated with the bounds and origin etc. I wish I had a specific question as to where this was going wrong, but I really don't know where the problem lies. Here are a few things I don't yet grasp:


at the momement all the paths are encoded with the same key name.

[coder encodeObject: [self linePath] forKey:@"thePath"];

If this is wrong, I'm not sure how to go about making new names for every path (one path per graphic object).

Secondly, I don't encode my actual graphic objects anywhere, and I'm not sure where I'd do that if it's necessary. In MyDocument?

How does the decoder know to go though the array and decode all the paths? The array does appear to have the right amount of objects in it when it is decoded, and it says they are of the class corresponding to the graphic instances. I would so love to be able to save these lines, and open them again, and get on with doing the program I want to create!

Thanks in advance,

Ian.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Really struggling with Saving in NSDocument
      • From: SA Dev <email@hidden>
  • Prev by Date: Re: email processing on Mac OS X.
  • Next by Date: Re: email processing on Mac OS X.
  • Previous by thread: Re: email processing on Mac OS X.
  • Next by thread: Re: Really struggling with Saving in NSDocument
  • Index(es):
    • Date
    • Thread