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.
Anchors and the safe area - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Anchors and the safe area
- You've just made your first auto-layout code. We are ready to run. Change your simulator to the iPhone 10, build, and run. When the list appears, select French toast. The French toast image appears as the full screen background but the label is cut off by the navigation bar. Press Command + left arrow to rotate the phone. The iPhone 10's notch now blocks the label. Let's explore what's going on here and how to prevent it. So far, we've been using the view's frame for the relationship to the sub views. However, there's several areas, like navigation bars, tool bars, and that iPhone 10 notch that can get in the way of those. There's a special area called the safe area that has boundaries that contextually take those into account. Let's add those to our project. First of all, rotate the phone back with the Command + right arrow and then stop the app. You can close up the console to give yourself some space. And now go to the label layout for top. So I'm gonna go to my label layouts…
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)
Basic preparation3m 53s
-
(Locked)
Pin and size individual constraints7m 59s
-
(Locked)
Anchors and the safe area5m 54s
-
(Locked)
Align views9m 24s
-
(Locked)
Errors in Auto Layout8m 26s
-
Size views with multipliers5m 40s
-
(Locked)
Aspect ratio with multipliers5m 37s
-
(Locked)
Challenge: Oatmeal56s
-
(Locked)
Solution: Oatmeal7m 29s
-
(Locked)
-
-
-
-
-