Re: Constraining window width to scrolling contents with autolayout
Re: Constraining window width to scrolling contents with autolayout
- Subject: Re: Constraining window width to scrolling contents with autolayout
- From: Jonathan Hull <email@hidden>
- Date: Mon, 25 May 2015 00:35:28 -0700
I believe this is where the constraint priorities come in. The window size will be affected by constraints with priorities larger than 500 and may override constraints under 500. Also, when dealing with ScrollViews it can get a bit tricky, so it helps to add a single view inside the scrollView which you can apply constraints against and then add your contents to that view.
In this case you would add an inequality constraint between that view in the scrollView and the window’s main view (i.e. the window width must be less-than-or-equal to the scrollView’s content plus some constant). You might need to write that programmatically (as opposed to in IB).
(Note: This is off the top of my head, haven’t gotten a chance to test it)
Thanks,
Jon
> On May 24, 2015, at 10:00 PM, Rick Mann <email@hidden> wrote:
>
> I have a bunch of views statically arranged inside an NSScrollView. Their relative size doesn't change. But it's a large view, and I want to be able to view it on smaller displays, hence the scroll view.
>
> Is there a way to constrain the window size to never be larger than just big enough to disable to scroll bars using autolayout constraints?
>
> --
> Rick Mann
> email@hidden
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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