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: Kyle Sluder <email@hidden>
- Date: Tue, 20 Mar 2012 11:21:14 -0700
On Mar 20, 2012, at 11:14 AM, Charles Srstka wrote:
> On Mar 20, 2012, at 1:03 PM, Kyle Sluder wrote:
>
>>> What I’m trying to find is the upper limit on the width and height
>>> according to the current set of constraints at runtime, when I don’t
>>> necessarily know what the subviews or their constraints are.
>>
>> I do not believe this question makes sense from the perspective of the
>> layout system.
>
> Sure it does. For example, take a view that has a maximum width, per its constraints, and make it the content view of an NSWindow. Now run the app and play around with resizing the window by dragging its edges. Notice how once you try to resize it to a width greater than the view’s maximum width, NSWindow stops resizing it any wider and keeps the width at the maximum. Somehow, NSWindow has figured out the maximum width of the view and adjusted its resize requests accordingly. How does it do that?
It ran the constraints system, solved for the maximum size of the content view, and prevented you from resizing the NSWindow. But it knew what all the subviews were: the empty set. That's not the same as solving the constraints system without regard to subviews.
--Kyle Sluder
_______________________________________________
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