• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to zoom with auto layout?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: NSPrivateQueueConcurrencyType working outside of performBlock
  • Next by Date: Re: iOS 8.4: Converting a URL into a PHAsset
  • Previous by thread: Change window's rootViewController at runtime
  • Next by thread: iOS 8: Can any of you guys think of why an async creation of a UIAlert would generate an exception on a show?
  • Index(es):
    • Date
    • Thread