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.

Solution: Cake

Solution: Cake - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

Solution: Cake

(soft music) (whooshing) - [Instructor] Okay, there's a lot of solutions for this particular case, but the simplest thing, and I want to show you how to do it on the simplest version, is our goal is to take whatever is holding this leading edge to the label to make it a trailing edge of the label. That's our goal. Go ahead and stop the app, close everything up, move over to CakeViewController. You can even get rid of navigation for now so that we have plenty of room. Head down to viewWillLayoutSubviews. You see I've already got a lot of this code already in place, so you're in good shape there. Just like we just did. Now, scroll on down a little further. Almost all of our constraints are the same as what we just did. We just have to find one that will do what we need it to do and it just so happens to be right here. Is the orderButton.leading is equal to the label.leading? This is the constraint I gotta work with. What I'm gonna do with this is very simple. Let's make a space. I'm…

Contents