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: Quincey Morris <email@hidden>
- Date: Mon, 21 Sep 2015 15:06:45 -0700
- Feedback-id: 167118m:167118agrif8a:167118sShSBAx2tQ:SMTPCORP
On Sep 21, 2015, at 14:52 , Marek Hrušovský <email@hidden> wrote:
>
> Personally I would do it like this:
> 1. Figure out what values you need to store
> 2. Create custom object called configuration; for each window one kind
> 3. Make it conform nscoding and add a delegate property (which will point
> to windowcontroller)
> 3. implement initwithcoder/encodewithcoder
> 3. add this to your model
I agree with your general approach, but I think it needs to be understood that the “values you need to store” should be representations of the UI state in terms of the data model, not the UI state itself. That is, I think it’s a terrible idea to archive window controllers, or scroll offsets, or any view geometry like that. You don’t know that you can actually recreate the original UI state (for example, you don’t even know you can restore the original window sizes, since the display configuration can change at any time).
I also agree with your point that competing with state restoration may not work out so well. It should be possible to turn off all manifestations of state restoration, but in practice this is another lousy compromise.
_______________________________________________
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