On Feb 2, 2012, at 14:06 , Quincey Morris wrote:

> I have a window nib that contains a scroll view controlling a custom view. 
> This custom view has an essentially arbitrary size in the nib -- it's resized 
> at window load time to a suitable size. (It's a kind of canvas, so its size 
> depends on the zoom factor and the user-selected canvas dimensions in 
> inches.) If the user has previously zoomed in, increasing the frame size of 
> the custom view, the scroll position appears to have been correctly saved in 
> the scroll view's restorable data, but it doesn't get restored properly at 
> the next window restoration.

FWIW I found a workaround that's fairly simple, though ugly:

1. The view forces its window controller to save the zoom factor in the window 
controller's restorable state. (Sadly, it doesn't work trying to get it from 
the view state in step 2.)

2. In the document's 
'restoreDocumentWindowWithIdentifier:state:completionHandler:' override, the 
zoom factor is first retrieved from the combined state, then passed as a 
parameter to creation of the window controller.

3. In 'windowDidLoad', the window controller tells the view what the initial 
zoom factor is supposed to be. That means that the view can calculate the 
*correct* frame size before the scroll amount is restored.


_______________________________________________

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