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 - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Embed subviews6m 57s
-
(Locked)
Add constraints to subviews7m 42s
-
(Locked)
Add Visual Format Language to subviews7m 4s
-
(Locked)
Intrinsic content size6m 36s
-
(Locked)
Inequalities in constraints8m 23s
-
(Locked)
Priorities in coded constraints7m 8s
-
(Locked)
Size ranges in Visual Format3m 33s
-
(Locked)
Challenge: Pasta56s
-
(Locked)
Solution: Pasta7m 54s
-
(Locked)
-
-