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.
Alignment and multiple constraints - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Alignment and multiple constraints
- [Instructor] In the current layout, you have the order button hanging out all the way to the lower right. Why is it there, and how can we change its position easily? That is where alignment becomes important in the visual language. Stop the app. Look at the horizontal constraint again. It gave a lot of expositioning information in the string, but no why information. That's actually done in the options parameter of the constraints method. Currently, it is set to align all bottom. Replace that with a period. And auto complete will show you all the options available. Not all of this will work with every constraint. Horizontal constraints only work with vertical alignments like alineAllTop or alignAllFirstBaseline. Select alignAllTop. Run, and the order button, will move to the top. Okay, stop the app. Change it to alignAllFirstBaseLine. Run again. Click hamburger. And now it's centered on the baseline. You can do the same thing with the label. Stop the app. And I'm first gonna change…
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)
Prepare for the Visual Format Language7m 14s
-
(Locked)
Visual Format basics5m 28s
-
Visual Format pin constants4m 48s
-
(Locked)
Alignment and multiple constraints6m 50s
-
(Locked)
Use sizes with Visual Format8m 40s
-
(Locked)
Metrics, margins, and anchors6m 10s
-
(Locked)
Errors in Visual Format5m 31s
-
(Locked)
Challenge: Peanut butter55s
-
(Locked)
Solution: Peanut butter10m 9s
-
(Locked)
-
-
-
-