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 (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