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.
Align views - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Align views
- [Instructor] We did the layout for the label in the image. Now it's time to do the buttons. I'll put the order and back buttons on top of each other on the bottom here. We'll align these buttons with the label. So go ahead and stop the app. There's no big change here in how we write constraints. You use other subviews instead of a superview. Generally an alignment has a constant of zero. You'll also use the same edge so a bottom one will be a bottom on top of the other. You'll also use the same edge. So a bottom attribute on one will be the bottom attribute on the other. Scroll to the order button mark. Make yourself some space and I'll set the order button aligned to the label's leading and trailing edges. I'll copy a leading constraint from above to save myself some time. Copy. Paste it here and then modify it so that it'll be order button leading equals label leading. And then I'll change the constraint to match it. So here change this image view to order button. And view to…
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)
Basic preparation3m 53s
-
(Locked)
Pin and size individual constraints7m 59s
-
(Locked)
Anchors and the safe area5m 54s
-
(Locked)
Align views9m 24s
-
(Locked)
Errors in Auto Layout8m 26s
-
Size views with multipliers5m 40s
-
(Locked)
Aspect ratio with multipliers5m 37s
-
(Locked)
Challenge: Oatmeal56s
-
(Locked)
Solution: Oatmeal7m 29s
-
(Locked)
-
-
-
-
-