kodeco.com Forums

Video Tutorial: Intro to Auto Layout Part 2: Interface Builder and Auto Layout II

Learn about different ways you can use control drag to create constraints and how to use container views to apply constraints to a group of views.

This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3201-auto-layout/lessons/3

Small thing I want to mention. When talking about stack views Pin button was shown.

Thanks! I’ll see if we can get that fixed.

Hello Thanks a lot for the video

I tried to do the exercise with three objects. scrollview with a view inside image, a control page and a text box. nothing works, setting page is a disaster it is impossible to correctly me three object correctly.

Have a good day

Constraints to a scroll view work a little differently. Most constraints between subviews of the scroll view and the scroll view itself are NOT going to act against the scroll view’s frame. Instead, those constraints act on the scroll view’s content area and help define the scrollable size. But constraints between views outside the scroll view DO act on the scroll view’s frame. I hope that helps.

Thank you, but completely nothing understood

Try watching the series on scroll views, that might help. Also, my session on Auto Layout at RWDevCon talked about scroll view constraints some.

Something has to define the height of that view. Adding a fixed height constraint to the view will do it, but isn’t the best solution. I usually think of constraints as “top down” meaning that the top view in the hierarchy has a defined size and position and the rest of the views down the tree derive their size and position from the top. This is an example of the opposite. The container view will derive it’s height from it’s contents. But, you have to give it enough information to do that. In this case, if you have a top space constraint between the first name text field and the container, AND a bottom space constraint between the age text field and the container, AND constraints between all the text fields, the container view will know its height from those constraints.

Thank you for your videos. You are helping me to understand Auto Layout.

Thanks! Glad they’re helpful. Sorry for the delay getting to your other question. If you have any questions still, please feel free to ask.

I think the step #10 needs an annotation for set left/right I-beam to standard value.:slight_smile:

Do you think you will be updating these videos to Xcode 8 iOS 10?

Yes, I’m working on a new version of the series right now! :]