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 - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
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…
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)
Embed subviews6m 57s
-
(Locked)
Add constraints to subviews7m 42s
-
(Locked)
Add Visual Format Language to subviews7m 4s
-
(Locked)
Intrinsic content size6m 36s
-
(Locked)
Inequalities in constraints8m 23s
-
(Locked)
Priorities in coded constraints7m 8s
-
(Locked)
Size ranges in Visual Format3m 33s
-
(Locked)
Challenge: Pasta56s
-
(Locked)
Solution: Pasta7m 54s
-
(Locked)
-
-