> On Sep 21, 2015, at 12:09 PM, Kurt Sutter <k...@quansoft.com> wrote:
> 
> I am trying to figure out how to store information about my windows and views 
> in a document, and how to restore it.

Here is what I do in one application.

Override -[NSDocument 
writeToURL:ofType:forSaveOperation:originalContentsURL:error:] to save extra 
information when saving the document. This app has a core data store so the 
extra information is stored there along with the document data.

Override -[NSDocument readFromURL:ofType:error:] to fetch the extra information 
when opening a document.

This app has very specific requirements about the extra information and what it 
does so it  subclasses NSWindow and NSWindowController. I could never get the 
window and views to do or behave as required so subclassing gives you a much 
finer grain control over what happens.

All this should be done with caution. You need to make sure that what you are 
doing will be well received and beneficial to your user base, some of which are 
likely to be Mac fanatics. Just because you can do it or think of if it does 
not mean that you should.

--Richard Charles


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to