On Sep 21, 2015, at 11:09 , Kurt Sutter <[email protected]> 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 protected])
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 [email protected]