The 1.Size class is used with auto layout to make auto layout less complex.
2.Size classes is actually the Size of the iOS device screen is categorized for example: iphone4s horizontal screen wcompact/hcompact, vertical screen wcompact/hregular; IPhone5S (6,6+) Horizontal screen wregular/hcompact, vertical screen wcompact/hregular, ipad screen is wregular/hregular
3. Theoretically if a view does not have any constraint, then the view will have no location and size, but it is no problem at present, what is the solution? If you do not add any constraint to a view, the system will automatically add the left, top, width, and height four constraints to the view, that is, the new Green view will have a fixed width and height, and then to the upper left corner of the screen as a reference point, there is a system to add the default location. (If we add any additional constraints to the Green view, the system automatically adds a constraint that is invalidated)
4. Another problem is that a number of different types of simulators have just been switched, which is equivalent to switching between different size classes, but the green view is normal, and the size class exists to distinguish between different size Class (for example: iphone4s horizontal screen wcompact/hcompact,iphone4s vertical screen wcompact/hregular,ipad screen is wregular/hregular), and then to do a different UI layout, what solution? The current size class is wany/hany, which means that when the size class is Wany/hany, constraint is added, and it takes effect at the other size class. In fact, as can be seen literally, any is any meaning, compact and regular is the subclass of any.
5. Usage of AutoLayout:
A When you need to show a lot of content and size is not fixed;
b programs need to support screen rotation (mainly the ipad program, the iphone app landscape is a bit non-mainstream);
C programs are common to iphone and ipad;
Sizeclass and AutoLayout