From the course: iOS Development: Auto Layout Programmatically

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Aspect ratio with multipliers

Aspect ratio with multipliers - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

Aspect ratio with multipliers

- [Instructor] You've scaled based on the height to height and width to width. The proportions don't have to be in a single dimension. You can set a proportional aspect` ratio using the multiplier. To make this a little easier visual, I'm first gonna make a bigger button. Let's start by rotating back the simulator and closing it, close up the console. So you can see what you're doing. And find the order button dot height. And I'm gonna change that from what it's right now to a quarter of the view. And then I'm gonna take this and I'm gonna make a new constraint. So copy it, paste it and the new one will be the order button with equal to the order button height. That makes a square button. Now before you run this, you should have a queasy feeling about this code. I set the width two ways, through the pins and the proportions with of back button and this new constraint. Before we get this error, let's think of what to do. Let's pop up the simulators again for a little bit of a visual…

Contents