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

Automatically resize parent view when subviews resize


  • Subject: Automatically resize parent view when subviews resize
  • From: Lorenzo Thurman <email@hidden>
  • Date: Sun, 13 Apr 2014 23:01:59 -0500

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


_______________________________________________

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: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Navigation Design question
  • Next by Date: NSTask: how to launch a binary as if I launched it via terminal?
  • Previous by thread: Cocoa application bundle with help file rejected on the store
  • Next by thread: Re: Automatically resize parent view when subviews resize
  • Index(es):
    • Date
    • Thread