In IOS8, we don't have to create multiple xib files to fit different types of screens as we used to, and now we can put the fit of various sizes of screens into one file, and then we can customize the interface of various sizes with different categories of size. In other words, the Storyboard in front of you is not an ordinary Storyboard, but a nine-in-one Storyboard that can manage nine kinds of screens.
For width and height, there are three cases: compact, arbitrary (any), normal (Regular), so there are 3*3=9 categories altogether.
The page will be prompted when the Size Class is set. By default, the width and height are any, for example.
We can see from the Size class setting interface, the above text any width any height is the expression width and height are arbitrary; the text below for all layouts meaning is clearly applicable to all dimensions.
The role of size class is to classify screens of different sizes, and the final layout management is AutoLayout.
Now let's do a little experiment by first adding a center button to the view, as shown in
We then go to the size class's setup interface and set the size to as shown
From the upper text of the size class setting interface, you can see that the width is normal and the height is compact; the for 5.5inch iPhones in landscape can be seen from the text below. Meaning is suitable for 5.5 inch iphone horizontal screen, that is iphone6+ horizontal screen. (As for the other size, I will no longer demo, just show this one, I think everyone can extrapolate). We're going to put a button on the screen this time, like
At this time to run the program can see the effect, we added the first button, whether with iphone4,5 or 6, etc. will appear, but the second Add button, only in the case of iphone6+ horizontal screen will appear. I think you should understand why the second button will only show up on the iphone6+. I'm not going to explain that anymore.
Demo results (iphone6+ vertical screen and horizontal screen)
teach you to use size Class