Beginning Auto Layout - Part 5: Nesting Stack Views | Ray Wenderlich

Success finally! Holy cow! I knew it had to be the workflow and a logical progression! And now I understand the scaling/sizing relationships between the stacks, nested stacks and nested elements etc. etc. And constraints are the icing on the cake! The super glue if you will!

I was barely in the ballpark, but it all finally came together at long last!

Very cool and I am a very happy camper!

Thx Jerry!

I tried that but it still keeps the buttons at the same heigh and width and does not allow them to change. I added constraints on the stack view to the top, leading trailing and bottom of the super view but never makes a diff.

It seems that constraints are introduced after you need them. I can’t duplicate the stack view layout because there are constraints that clearly must be added, but I don’t know how to add them, nor in what sequence they should be added. Am I missing something?

Yeah, to get the challenge layout exact, you’ll need to use constraints, which are presented in the next video. You can get the concept of nested stack views without using constraints though.

In the part of the video about Equal Spacing you are talking about when the views and minimum spaces are too large for the stack view. You say the first view (along the distribution axis) will be at its intrinsic size and one of the other views will be squished according to the compression resistance of the other views. So here, any view with a lower compression resistance will be the one squished. But then you say that if there is a tie among the compression resistance of the remaining views, the layout will use the “arranged subviews to break a tie”. What does that last sentence mean?

thanks

The stack view manages its views using an arrangedSubviews property. If you’re dragging in views in Interface Builder, this property is managed for you - it will contain all the subviews of the stack view. If there is a tie in the priority between these subviews, the first one in the arrangedSubviews property is the one that will get resized.