IOS screen Adaptation Sizeclass

Source: Internet
Author: User

1. Various technologies for screen adaptation

1> 3gs\4\4s era: No screen fit one said, size only one, directly in the code to calculate the frame is ok

2> ipad appears: In order to cope with the screen, Apple introduced autoresizing, its role is to let the child control to follow the parent control to do the stretching. For example, autoresizing can have the width of the Red child control always fill the screen

3> 5\5c\5s Appearance: Autoresizng is not enough, because it can only solve the problem of parent-child relationship control arrangement, not solve the relationship between the sibling control, so AutoLayout appeared.

AutoLayout, you can establish a positional relationship between any of the 2 controls

4> 6\6plus Appearance: AutoLayout is not enough, Sizeclass can achieve autolayout do not need

Why AutoLayout is not enough:

A>universal project, there are 2 sets of storyboard, one for the iphone and another for the ipad, which means that every set of storyboard, set constraints

B> non-universal projects, such as the iphone project, AutoLayout unable to achieve different sizes of iphone using different layout schemes

2.sizeclass

1>sizeclass simply classifies the screen, actually arranging UI elements or AutoLayout

2> no longer have the concept of a screen size

3> no longer have the concept of specific dimensions, only the concept of abstract dimensions

2.1 Abstract Size: The length and width are divided into 3 kinds: compact, any,regular (loose)

1> Such a division, the screen size on the 9 kinds of permutations and combinations:

  

2> you can add different constraints to a control under different screen size types

3> can allow the same imageview to be washed in different screen sizes, showing different pictures

4> also allows labels to display different font sizes under different screen dimensions.

5> Symbol Explanation:

-Compact

* ANY

+ Regular

6> Note the inheritance of dimensions: any Width | Any Height is the base Values for all layouts, which means that at any Width | Any height dimension type, the constraints added to the control affect other dimension types. For example, the following two constraints will report a warning.

At any Width | Any Height adds a constraint to the button with a fixed distance to the left edge.

In the compact Width | The compact Height adds a constraint to the button with a fixed distance to the right boundary.

IOS screen Adaptation Sizeclass

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.