Re: Saving window and view state with NSDocument
Re: Saving window and view state with NSDocument
- Subject: Re: Saving window and view state with NSDocument
- From: Kurt Sutter <email@hidden>
- Date: Mon, 21 Sep 2015 21:41:53 +0200
Isn’t state restoration something that goes into the app’s preferences (or somewhere else into the app’s container)? What I am looking for is some way to store that information in the document.
> On 21 Sep 2015, at 20:53, Quincey Morris <email@hidden> wrote:
>
> On Sep 21, 2015, at 11:09 , Kurt Sutter <email@hidden <mailto:email@hidden>> wrote:
>>
>> I want the state information of the windows and views to be stored in the document so that the same windows and views reopen when the user opens the document.
>>
>> What is the best way to do that? I guess I have to take two steps:
>>
>> (a) collect that state information in dataOfType:error: and store it in the NSData object to be returned and
>> (b) retrieve that data from the NSDocument in readFromData:ofType:error: and then somehow apply it in the NSDocument’s makeWindowControllers method.
>
> You don’t mention OS X state restoration:
>
> https://developer.apple.com/library/prerelease/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/StandardBehaviors/StandardBehaviors.html <https://developer.apple.com/library/prerelease/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/StandardBehaviors/StandardBehaviors.html>
>
> (under heading "Windows Are Restored Automatically”), but that sounds like what you’re looking for.
>
> Note that state restoration is extremely badly documented in Apple’s documentation. You’ll need to sift through API for individual classes and protocols, and sometimes look at the Obj-C header comments, to get a reasonably complete picture of what’s going on.
>
> There are probably some relevant WWDC videos, perhaps starting with "Resume and Automatic Termination in Lion” from 2011.
_______________________________________________
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