Re: How to get max size of view according to constraints?
Re: How to get max size of view according to constraints?
- Subject: Re: How to get max size of view according to constraints?
- From: Charles Srstka <email@hidden>
- Date: Tue, 20 Mar 2012 19:13:07 -0500
On Mar 20, 2012, at 7:00 PM, Peter Ammon wrote:
> 2. Establish another constraint that says the height of the document view equals the height of the scroll view. Give this constraint a priority lower than required. What its priority should be depends on how tightly you want the document view to fill the scroll view, i.e. which other constraints it should be allowed to break.
This sounds great in concept, but the height I want (if the constraints will allow it) is the scroll view’s documentVisibleRect, not its frame, since the latter includes the size of the scroll bars if they’re visible, and I don’t think that’s doable directly via constraints. However, watching the scroll view’s NSViewFrameDidChangeNotification and manually adding non-required constraints to the size I get from -documentVisibleRect (and clearing out those constraints the next time) works like a champ. As you point out, the mistake I was making before was calling setFrame: here instead of doing this via constraints. Thanks!
Charles
_______________________________________________
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