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.

Intrinsic content size

Intrinsic content size - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

Intrinsic content size

- You've used multiple auto-layout techniques to make the PizzaViewController. In the current case, you've used proportions and absolute sizes to control size the views. There's several advanced techniques you can use to control size, not by proportions of the view but by the intrinsic content size. You've seen this before, by the way. When you don't use a size constraint, auto-layout has been using the intrinsic content size. Before we learn how to set constraints by content size, it's important to understand the differences between size and intrinsic content size. In the PizzaViewController, stop the app and head to the addLabelView method. Find the label.height constraint and comment it out. Head up to the addButtonView and comment out those two size constraints. Finally, in LayoutViews, comment out the buttonView.width. Now go ahead and run the app. Go to Pizza and you'll see something interesting happen. Three of the views shrunk in one way or another and one is making up the…

Contents