Re: Automatically resize parent view when subviews resize
Re: Automatically resize parent view when subviews resize
- Subject: Re: Automatically resize parent view when subviews resize
- From: Fritz Anderson <email@hidden>
- Date: Mon, 14 Apr 2014 09:28:13 -0500
On 13 Apr 2014, at 11:01 PM, Lorenzo Thurman <email@hidden> wrote:
> I have an NSView with two subviews (A & B) placed horizontally with respect to each other. The subviews can take a variable number of uniformly sized subviews. I’ve placed these constraints on subviews A & B, (all done in IB):
> (They should both have the same height)
>
> Top space to container
> Bottom space to container
> Horizontal spacing between A & B
> Intrinsic View -> Placeholder -> Width checked to None
> Horizontal content hugging priority set to 1
>
> The left has:
> Leading space to container
>
> The right has:
> Trailing space to container
>
> The parent view has:
> Intrinsic View -> Placeholder -> Width checked to None
> Horizontal content hugging priority set to 1
>
> With these constraints, I would expect the parent view to resize itself horizontally as the subviews (A & B) try to expand to accomodate the addition of more subviews. But instead, the parent view does not resize at all, subviews A & B do not resize and their subviews are crammed together as more are added. If I remove the Horizontal spacing between A & B, they both resize horizontally, and if I add enough subviews to each, they extend beyond the right edge of the parent view.
>
> So, how what mojo do I need to apply to get the parent to resize horizontally?
> I’m really just getting started with Auto layout, and it seems more confusing than it probably really is or should be.
> Thanks
What constraints are you putting on the subviews you add dynamically to A and B?
— F
_______________________________________________
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