iPhone手机屏幕尺寸一般指:物理像素,ps像素。
iPhone的app现在一般适配2倍图和3倍图。
iphont4s 是2倍图,但是你画一个粗为0.5的线,iphont4s显示不出来,iphont5s却可以看到一个像素(从截图上看到的)的线来。
识别手机机型使用的是几倍图,一般通过这个值来识别:[UIScreen mainScreen].scale。若为1就1倍图(iphone 4/iphone 4s是个例外),若为2就是2倍图,若是3就是3倍图。但是现在iphone 4/iphone 4s都是按照2倍图处理的,并且他们的屏幕截图也是640*960,说明它是2倍图。但是若你在iphone 4/iphone 4s手机上画条0.5像素的线是显示不出来的,但是在iphone 6及更高版本画一条1/([UIScreen mainScreen].scale)(就是0.5或1/3)的线是显示出来的,说明iphone 4/iphone 4s物理分辨率是1像素。
准确的倍图计算公式是:round(屏幕截图宽度/[[UIScreen mainScreen] bounds].size.width)。屏幕截图(上传苹果商店的屏幕快照或者用手机截屏得到的图片)的宽度(或高度)除以物理宽度(或高度,宽度是[[UIScreen mainScreen] bounds].size.width,高度是[[UIScreen mainScreen] bounds].size.height)的四舍五入的整数。iPhone XR的828/375=2.2.08,四舍五入值是2,它的[UIScreen mainScreen].scale也为2(FULL_WIDTH:375.000000, FULL_HEIGHT:812.000000, [UIScreen mainScreen].scale:2.000000),所以它是用2倍图。
下面是开发中用到的iphone,ipod,ipad对应的实际像素点和图片倍率:
iphont4,iphone4s实际像素点:
3.5英寸屏(320/480)
iphone5,iphone 5s,iphone 5se实际像素点:
4英寸屏 (320/568)
iphont6,iphone7,iphone8实际像素点:
4.7英寸屏(375/667)
iphont6 plus,iphone7 plus,iphone8 plus实际像素点:
5.5英寸屏 (414/736)
iphontX若不设置启动图片相当于iPhone8的放大模式(375/667) ,若设置了启动图片才是他的实际像素 实际像素点:
5.8英寸屏(375/812)
iPhone 12 mini实际像素点:
5.8英寸屏(375/812)
ipod4实际像素点:
4英寸屏(320/568)
iphontX若不设置启动图片相当于iPhone8的放大模式(375/667) ,若设置了启动图片才是他的实际像素,实际像素点:
5.4英寸屏(iPhone 12 mini,iPhone 13 mini)(375/812)
5.8英寸屏(iPhone X,iPhone XS,iPhone 11Pro)(375/812)
6.1英寸屏(iPhone XR,iPhone11) (414/896)
6.1英寸屏(iPhone12,iPhone13, iPhone 13 Pro, iPhone 14) (390/844)
6.5英寸屏(iPhone XS Max, iPhone 11 Pro Max, iPhone 12 Pro)(414/896)
6.7英寸屏(iPhone 12 Pro Max,iPhone 13 Pro Max, iPhone 14 Pro,iPhone 14 Plus)(428/926)
ipod4实际像素点(强制横屏模式):
4英寸屏(320/568)
只支持iPhone不支持iPad的app在iPad上运行都是2倍图,竖屏模式实际像素点:(375/667)
iPad (8th generation) FULL_WIDTH:375.000000, FULL_HEIGHT:667.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000
iPad Air(4th generation) FULL_WIDTH:375.000000, FULL_HEIGHT:667.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000
iPad Pro (9.7-inch) FULL_WIDTH:375.000000, FULL_HEIGHT:667.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000
iPad Pro (11-inch) FULL_WIDTH:375.000000, FULL_HEIGHT:667.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000
iPad Pro (12.9-inch) FULL_WIDTH:375.000000, FULL_HEIGHT:667.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000
现在支持iPad的app在iPad上运行都是2倍图,注意有的有上部感应区,没有下部感应区,竖屏模式实际像素点如下:
测量代码:
//iPhoneX--机型获取 #define LL_iPhoneX \ ({BOOL isPhoneX = NO;\ if (@available(iOS 11.0, *)) {\ isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.top > 0.0;\ }\ (isPhoneX);}) #define have_bottom_safeArea \ ({BOOL isHave = NO;\ if (@available(iOS 11.0, *)) {\ isHave = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\ }\ (isHave);})
NSLog(@"phoneType:%@, FULL_WIDTH:%f, FULL_HEIGHT:%f, [UIScreen mainScreen].scale:%f, 倍率:%f, 是否有顶部感应区:%@, 是否有底部感应区:%@,横纵比:%f, safeAreaInsets.top:%f, safeAreaInsets.bottom:%f, 顶部工具栏高度:%f, 底部工具栏高度:%f",[BITSingleObject sharedInstance].phoneType, FULL_WIDTH, FULL_HEIGHT, [UIScreen mainScreen].scale, [UIScreen mainScreen].scale, LL_iPhoneX?@"有":@"没有", have_bottom_safeArea?@"有":@"没有",FULL_WIDTH/FULL_HEIGHT, [[UIApplication sharedApplication] delegate].window.safeAreaInsets.top, [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom,[[UIApplication sharedApplication] delegate].window.safeAreaInsets.top+44, [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom+49);
iPad (5th generation),iPad (6th generation) phoneType:x86_64, FULL_WIDTH:1024.000000, FULL_HEIGHT:768.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad (7th generation)iPad (8th generation) honeType:x86_64, FULL_WIDTH:1080.000000, FULL_HEIGHT:810.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad Air 2 phoneType:x86_64, FULL_WIDTH:1024.000000, FULL_HEIGHT:768.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad Air(3th generation) phoneType:x86_64, FULL_WIDTH:1112.000000, FULL_HEIGHT:834.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad Air(4th generation) phoneType:x86_64, FULL_WIDTH:1180.000000, FULL_HEIGHT:820.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:有,横纵比:1.439024, safeAreaInsets.top:24.000000, safeAreaInsets.bottom:20.000000, 顶部工具栏高度:68.000000, 底部工具栏高度:69.000000;
iPad Pro (9.7-inch) phoneType:x86_64, FULL_WIDTH:1024.000000, FULL_HEIGHT:768.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad Pro (11-inch) phoneType:x86_64, FULL_WIDTH:1194.000000, FULL_HEIGHT:834.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:有,横纵比:1.431655;
iPad Pro (12.9-inch)(1st generation),iPad Pro (12.9-inch)(2th generation) phoneType:x86_64, FULL_WIDTH:1366.000000, FULL_HEIGHT:1024.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333984, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000;
iPad Pro (12.9-inch) (3th generation),iPad Pro (12.9-inch) (4th generation)phoneType:x86_64, FULL_WIDTH:1366.000000, FULL_HEIGHT:1024.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:有,横纵比:1.333984, safeAreaInsets.top:24.000000, safeAreaInsets.bottom:20.000000, 顶部工具栏高度:68.000000, 底部工具栏高度:69.000000;
iPad Pro (10.5-inch) phoneType:x86_64, FULL_WIDTH:1112.000000, FULL_HEIGHT:834.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:84.000000, 底部工具栏高度:49.000000;
iPad Pro (11-inch)(1st generation), iPad Pro (11-inch)(2th generation) phoneType:x86_64, FULL_WIDTH:1194.000000, FULL_HEIGHT:834.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:有,横纵比:1.431655, safeAreaInsets.top:24.000000, safeAreaInsets.bottom:20.000000, 顶部工具栏高度:68.000000, 底部工具栏高度:69.000000;
iPad mini 4,iPad mini(5th generation) phoneType:x86_64, FULL_WIDTH:1024.000000, FULL_HEIGHT:768.000000, [UIScreen mainScreen].scale:2.000000, 倍率:2.000000, 是否有顶部感应区:有, 是否有底部感应区:没有,横纵比:1.333333, safeAreaInsets.top:20.000000, safeAreaInsets.bottom:0.000000, 顶部工具栏高度:64.000000, 底部工具栏高度:49.000000。
矢量图的图片倍率
iphont4 2倍图
iphont4s 2倍图
iphont5 2倍图
iphont5s 2倍图
iphone5 se 2倍图
iphont6 2倍图
iphont6 plus 3倍图
iphont7 2倍图
iphont7 plus 3倍图
iphont7s 2倍图
iphont7s plus 3倍图
iphont8 2倍图
iphont8 plus 3倍图
iPhone XR,iPhone 11 2倍图
iphontX,iPhone XS, iPhone XS Max, iPhone 11 Pro, Phone 11 Pro Max, iPhone 12 mini, iPhone 12, iPhone 12 Pro, Phone 12 Pro Max 3倍图
iphone se2 2倍图
ipod4 2倍图
iphone4,iphone5,iphoneX无放大模式。iphone6,7,8的放大模式屏幕像素是:(320/568)。iphone6 plus,7 plus,8 plus的放大模式屏幕像素是:(375/667)。
下面是iphone的ps像素(手机截图尺寸):
iphont4,iphone4s 像素尺寸:
3.5英寸屏(640/960)
iphone5,iphone 5s,iphone 5se 像素尺寸:
4英寸屏 (640/1136)
iphont6,iphone7,iphone8 ,iphone se2像素尺寸:
4.7英寸屏(750/1334)
iPhone 12 mini
5.4英寸屏(1080/2340)
iphont6 plus,iphone7 plus,iphone8 plus像素尺寸:
5.5英寸屏 (1242/2208)
iphoneX,iPhone XS,iPhone 11 Pro,iPhone 12 mini
5.8英寸屏(1125/2436)
iPhone XR,iPhone 11
6.1英寸屏(828/1792)
Phone 12
6.1英寸屏(1170/2536)
iPhone XS Max,iPhone 11 Pro Max,iPhone 12 Pro
6.5英寸屏(1242 / 2688)
iPhone 12 Pro Max
6.7英寸屏`(1284 / 2788)
iPhone 12 mini
5.4英寸屏 2340 x 1080 像素分辨率,476 ppi,模拟获取到的物理像素:(812/375)[UIScreen mainScreen].scale 倍率:3。可以看到它不是标准的3倍,不知道是模拟器错误,还是它就是这个奇怪的2.88倍率。