Resolution and pixels
Verified by the new xcode6 simulator (the resolution is PT and the pixel is real pixel ):
1. iPhone 5 resolution 320x568, pixel 640x1136, @ 2x
2. iPhone 6 Resolution 375x667, pixel 750x1334, @ 2x
3. iPhone 6 plus resolution: 414x736, pixel: 1242x2208, @ 3x, (note: After rendering at this Resolution, the image aspect ratio is reduced by pixel resolution to 1080 p (1080x1920)
Method 1: determine the size of the current device in the Code and manually adjust the UI elements. The disadvantage is obvious: the code is complex, error-prone, difficult to maintain, and extremely flexible;
Method 2: Set the Visual Unit (uiview uibutton ...) the autoresizing attribute of. It specifies how to adjust the size and position of a view when its environment (parent view) changes, this method can be set in xcode interface Builder (storyboard or XIB), but it can only be adjusted for the parent-child relationship, such as whether the left margin is fixed or the size is variable, the adjustment of sibling relationships cannot be achieved, and the adjustment method of apps with relatively fixed UI is basically enough;
Adaptation method 3: Use autolayout and sizeclass to comprehensively adjust the parent-child relationship and sibling relationship of the UI Visual Unit, and the adjustment accuracy is higher: not only can we determine the basis for changing the position and size of a view, but we can also set different priorities for the basis, which conditions are met first and then what conditions are met, priority can be ensured for important positions and sizes, so that the entire app has strong dynamic tonality and can meet the needs of different devices and different application scenarios.
IPhone 6 Resolution and adaptation