How to zoom with auto layout?
How to zoom with auto layout?
- Subject: How to zoom with auto layout?
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Wed, 29 Jul 2015 22:15:48 +0700
10.10.4
I want to zoom (width only) my NSView and want the mid-point of the view to be still in the mid after zooming.
The following code works - but only if zooming slowly.
How can one avoid the performSelector:afterDelay ?
Is there some notification like NSLayoutHasBeenDoneNotification ?
I tried NSViewFrameDidChangeNotification, but this is called much too often.
-(void)setZoomValue: (double)new
{
_zoomValue = new;
self.requiredWidth = …
double position = …
[ self invalidateIntrinsicContentSize ];
[ self performSelector: @selector(scrollPosition:) withObject: @(position) afterDelay: 0.1 ]; // 0.0 no good
}
- (NSSize)intrinsicContentSize
{
return NSMakeSize( self.requiredWidth, NSViewNoInstrinsicMetric );
}
- (void) scrollPosition: (NSNumber *)n
{
[ self scrollPoint: NSMakePoint(n.doubleValue,0) ];
}
Gerriet.
_______________________________________________
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