From the course: iOS Development: Auto Layout Programmatically

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add constraints to subviews

Add constraints to subviews - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

Add constraints to subviews

- [Instructor] So you have a small mess on your iPad. We haven't added any of the constraints within our views. Unlike the content we see here piled on each other, a basic UI view will collapse in on itself without any constraints. And that's what we're seeing here. I'm going to set up constraints in the button view with co-constraints and the label view ad with visual format language to show you the differences. Go ahead and stop the app. Since we're doing vertical buttons, I'm gonna start off scratch from those. So let's head up to the add button view, and just underneath here, these constraints we're gonna put in our first constraint. And I'm gonna start with the top and I'm just gonna work my way around this thing, so I'm gonna do order button dot top equals button view dot top. And notice here I'm going to the button view. The super view that we're gonna be talking about is this view, the button view. It's not the view. We're gonna be spending everything and trying to constrain…

Contents