From the course: iOS Development: Auto Layout Programmatically
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Size ranges in Visual Format - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Size ranges in Visual Format
- While you can write two inequalities for a range with code there's one visual format language trick yet to show you. Head to the label view to format strings. You'll notice that the vertical one re-added some inequalities to it. Now we're using one image here. Suppose we would be displaying images in different sizes. I'd like to remain in a visible range. I could put more than one inequality in a view's size. Before I do, I'm going to change the metrics. I earlier talked about intrinsic content size, and I used other things that aren't as reliable, such as line height, and image view size height, which isn't optional and that's got all kinds of problems. So it's better to use here intrinsic content size. So I'm gonna get rid of this, and change this to label dot intrinsic content size dot height. And I'm also gonna change this image height to image view dot intrinsic content size dot height. Now I'm sure I'm getting the correct intrinsic content size. I know exactly what that image…
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)
-
-