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

Alignment and multiple constraints - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

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…

Contents