Reputation: 42662
I have a UILabel and a Switch on storyboard, I use Stack View to group them, however,after embedded into a horizontal Stack View, I am not able to resize the stack view but only can move it around. Why?
(I am using XCode 8 + Swift 3)
===== UPDATE ======
Thanks guys suggesting for adding constraints, but .... I added constraints, but I still would like to see the constrainted layout on storyboard instead of messed up layout.
E.g. I added constraint to leading and trailing space to be 8 pixel away from parent, but I see red line which xcode gives to indicate the actual layout is not showing in the constraint way. That's the problem, I can only drag the stack view, but I want to resize it to match my constraint so that it looks same as that in real device.
Upvotes: 3
Views: 17530
Reputation: 721
In Interface Builder, start by dragging out a vertical stack view, and add the flowers label, image view, and edit button. Then set up the constraints as shown.
Upvotes: -2
Reputation: 3436
You need to add constraints to set the the placement of the StackView. To set the distance between the two controls, simply set the spacing as I've done in the image below (Spacing = 50):
Upvotes: 11