Re: Stack?
Re: Stack?
- Subject: Re: Stack?
- From: Jonathan Mitchell <email@hidden>
- Date: Sun, 05 Oct 2014 13:20:01 +0100
On 4 Oct 2014, at 02:06, Charles Jenkins <email@hidden> 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 (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
References: | |
| >Stack? (From: Charles Jenkins <email@hidden>) |