On 4 Oct 2014, at 02:06, Charles Jenkins <cejw...@gmail.com> wrote:

> Okay, here’s a dumb question… How do you make a stack view actually stack 
> things? When I add subviews into a stack view, instead of appearing one after 
> another as I expect, they’re all laid on top of one another.
> 
> 
>  self.theStack.alignment = NSLayoutAttributeBottom;  
> 
This might be the cause of your trouble. Just get rid of it. 

NSStackView is a great control once you get your head around it.

You can also embed it in an NSScrollView  - 
https://github.com/mugginsoft/TSStackView/blob/master/TSStackView.m#L452

I normally create a stack like so, populating it with views loaded from a NIB.

    self.stackView = [NSStackView stackViewWithViews:@[self.titleView,
                                                       self.view1,
                                                       self.view2,
                                                       ]
                      ];
    self.stackView.orientation = NSUserInterfaceLayoutOrientationVertical;
    self.stackView.spacing = 0;

Note that NSStackView calls -fittingSize on its subviews. If you have manually 
added constraints to your subview and they don’t fully constrain the view 
height (in the above example) then view will collapse to 0 height within the 
stack view.

J
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com
  • Stack? Charles Jenkins
    • Re: Stack? Jonathan Mitchell

Reply via email to