iPhone适配.md 1.72 KB

iPhone尺寸:

3GS 320x480 3.5-inch 640x960
4 320x480 3.5-inch 640x960
4s 320x480 3.5-inch 640x960
5 320x480 3.5-inch 640x960
5s 320x480 3.5-inch 640x960
6 320x480 3.5-inch 640x960
6p 320x480 3.5-inch 640x960

设备

iPhone

Width

Height

对角线

Diagonal

逻辑分辨率(point)

Scale Factor

设备分辨率(pixel)

PPI

3GS

2.4 inches (62.1 mm)

4.5 inches (115.5 mm)

3.5-inch

320x480

@1x

320x480

163

4(s)

2.31 inches (58.6 mm)

4.5 inches (115.2 mm)

3.5-inch

320x480

@2x

640x960

326

5c

2.33 inches (59.2 mm)

4.90 inches (124.4 mm)

4-inch

320x568

@2x

640x1136

326

5(s)

2.31 inches (58.6 mm)

4.87 inches (123.8 mm)

4-inch

320x568

@2x

640x1136

326

6

2.64 inches (67.0 mm)

5.44 inches (138.1 mm)

4.7-inch

375x667

@2x

750x1334

326

6+

3.06 inches (77.8 mm)

6.22 inches (158.1 mm)

5.5-inch

414x736

@3x

(1242x2208->)

1080x1920

401

适配须知:

原版设计图的约束数值都是按照iPhone6(4.7-inch)的设计给的,在项目中都是按照iPhone5(4-inch)的数值实际使用的

方法1:

`#define LayOutForScaleIPhone6P(offsetForIPhone6) ([DeviceTools is5p5InchPhone] ? (1.294 * offsetForIPhone6) : LayOutForScale(offsetForIPhone6))`

适用环境:

在没有新的设计图的情况下,项目内的参数都需要这个宏来做处理

方法名2:

`#define LayoutForFitIPhone6P(offsetForIPhone6,offsetForIPhone6P) ([DeviceTools is5p5InchPhone] ? offsetForIPhone6P : LayOutForScale(offsetForIPhone6))`

适用环境:

在有iPhone6P新设计图的情况下,需要使用这个方法,第一个参数是:(原来按照iPhone6给的约束),第二个参数是:(新的按照iPhone6P给的约束)