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

Trait collections - iOS Tutorial

From the course: iOS Development: Auto Layout Programmatically

Start my 1-month free trial

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…

Contents