• 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
Re: Automatically resize parent view when subviews resize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Automatically resize parent view when subviews resize
      • From: lorenzo <email@hidden>
References: 
 >Automatically resize parent view when subviews resize (From: Lorenzo Thurman <email@hidden>)

  • Prev by Date: Re: NSTask: how to launch a binary as if I launched it via terminal?
  • Next by Date: Re: NSTask: how to launch a binary as if I launched it via terminal?
  • Previous by thread: Automatically resize parent view when subviews resize
  • Next by thread: Re: Automatically resize parent view when subviews resize
  • Index(es):
    • Date
    • Thread