• 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: Saving window and view state with NSDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Saving window and view state with NSDocument


  • Subject: Re: Saving window and view state with NSDocument
  • From: Richard Charles <email@hidden>
  • Date: Tue, 22 Sep 2015 10:45:43 -0600

> On Sep 21, 2015, at 12:09 PM, Kurt Sutter <email@hidden> 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 (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


References: 
 >Saving window and view state with NSDocument (From: Kurt Sutter <email@hidden>)

  • Prev by Date: Re: Two Array Controllers, loading from CoreData, without a contentArray...
  • Next by Date: Re: Two Array Controllers, loading from CoreData, without a contentArray...
  • Previous by thread: Re: Saving window and view state with NSDocument
  • Next by thread: Top-level contextual menu for view hierarchy
  • Index(es):
    • Date
    • Thread