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.
Trait collections - iOS Tutorial
From the course: iOS Development: Auto Layout Programmatically
Trait collections
- [Instructor] Now how do you figure out what the size classes are programmatically? For that, you need something called a trait collection. And let's go take a look at the trait collection. Go ahead and stop the app, and I'm gonna go over here to the HotFudgeViewController and you'll find in here a sizeClassString that I added here. And here we have the three different types of size classes that exist. The two that we've already talked about is the compact, which has to do usually with iPhones, and regular, which almost always has to deal with iPads until you get into multi-pane stuff. And the one on top here is unspecified. Now, unspecified happens when you add views that haven't actually had any information about the device added to them. So, it's usually when you're adding views. 90% of the time we're not gonna get into that, because what happens is once you add it to a hierarchy, it often will take that with it, and the cases where it won't is beyond the scope of this course. So…
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
-
-
-
-
-
-
-
-
Why use size classes?2m 51s
-
(Locked)
Trait collections6m 26s
-
(Locked)
Determine the size class7m 51s
-
(Locked)
Dynamic trait changes on iPhone4m 24s
-
(Locked)
Dynamic trait changes on iPad4m
-
(Locked)
Dynamic trait changes on iPad (continued)5m 44s
-
(Locked)
Challenge: Cake29s
-
(Locked)
Solution: Cake9m 35s
-
-