答案是较旧的应用程序在 2208 x 1242 缩放模式下运行。但是,当为新手机构建应用程序时,可用的分辨率为:Super Retina HD 5.8 (iPhone X) 1125 x 2436 (458ppi)、Retina HD 5.5(iPhone 6、7、8 Plus) 1242 x 2208 和 Retina HD 4.7 (iPhone 6) 750 x 1334。这导致了问题中提到的混乱。要构建使用新手机全屏尺寸的应用,请添加以下尺寸的 LaunchImage:1125 x 2436、1242 x 2208、2208 x 1242 和 750 x 1334。
针对新款 iPhone 12、12 mini、12 Pro、12 Pro Max 进行了更新
iPhone 12 Pro Max 的尺寸,@3x 缩放,坐标空间:428 x 926 点和 1284 x 2778 像素,458 ppi,设备物理尺寸为 3.07 x 6.33 英寸或 78.1 x 160.8 毫米。 6.7 英寸超视网膜 XDR 显示屏。
iPhone 12 Pro 尺寸,@3x 缩放,坐标空间:390 x 844 点和 1170 x 2532 像素,460 ppi,设备物理尺寸为 2.82 x 5.78 英寸或 71.5 x 146.7 毫米。 6.1 英寸超视网膜 XDR 显示屏。
iPhone 12 的尺寸,@2x 缩放,坐标空间:585 x 1266 点和 1170 x 2532 像素,460 ppi,设备物理尺寸为 2.82 x 5.78 英寸或 71.5 x 146.7 毫米。 6.1 英寸超视网膜 XDR 显示屏。
iPhone 12 mini 的尺寸,@2x 缩放,坐标空间:540 x 1170 点和 1080 x 2340 像素,476 ppi,设备物理尺寸为 2.53 x 5.18 英寸或 64.2 x 131.5 毫米。 5.4 英寸超视网膜 XDR 显示屏。
iPhone 11 Pro Max 的尺寸,@3x 缩放,坐标空间:414 x 896 点和1242 x 2688 像素,458 ppi,设备物理尺寸为 3.06 x 6.22 英寸或 77.8 x 158.0 毫米。 6.5 英寸超视网膜 XDR 显示屏。
iPhone 11 Pro 的尺寸,@3x 缩放,坐标空间:375 x 812 点和 1125 x 2436 像素,458 ppi,设备物理尺寸为 2.81 x 5.67 英寸或 71.4 x 144.0 毫米。 5.8 英寸超视网膜 XDR 显示屏。
iPhone 11 的尺寸,@2x 缩放,坐标空间:414 x 896 点和 828 x 1792 像素,326 ppi,设备物理尺寸为 2.98 x 5.94 英寸或 75.7 x 150.9 毫米。 6.1" Liquid Retina 高清显示屏。
iPhone X? Max 的尺寸,@3x 缩放(Apple 名称:Super Retina HD 6.5 display"),坐标空间:414 x 896 点和 1242 x 2688 像素,458 ppi,设备物理尺寸为 3.05 x 6.20 英寸或 77.4 x 157.5 毫米。
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X? Max Screen bounds: (0.0, 0.0, 414.0, 896.0), Screen resolution: (0.0, 0.0, 1242.0, 2688.0), scale: 3.0
iPhone X? 的尺寸,@2x 缩放(Apple 名称:Super Retina HD 6.1" display),坐标空间:414 x 896 点和 828 x 1792 像素,326 ppi,设备物理尺寸为 2.98 x 5.94 英寸或 75.7 x 150.9 毫米。
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X? Screen bounds: (0.0, 0.0, 414.0, 896.0), Screen resolution: (0.0, 0.0, 828.0, 1792.0), scale: 2.0
iPhone X? 和 iPhone X 的尺寸,@3x 缩放(Apple 名称:Super Retina HD 5.8" display),坐标空间:375 x 812 点和 1125 x 2436 像素,458 ppi,设备物理尺寸为 2.79 x 5.65 英寸或 70.9 x 143.6 毫米。
let screen = UIScreen.main
print("Screen bounds: \(screen.bounds), Screen resolution: \(screen.nativeBounds), scale: \(screen.scale)")
//iPhone X? and X Screen bounds: (0.0, 0.0, 375.0, 812.0), Screen resolution: (0.0, 0.0, 1125.0, 2436.0), scale: 3.0
iPhone 6、6S、7 和 8 的尺寸,@3x 缩放(Apple 名称:Retina HD 5.5),坐标空间: 414 x 736 点和 1242 x 2208 像素,401 ppi,屏幕物理尺寸为 2.7 x 4.8 英寸或 68 x 122 毫米。在缩放模式下运行时,即在 iPhone 6 Plus 上没有新的 LaunchImages 或在设置中选择时,原生比例为 2.88,屏幕为 320 x 568 点,这是 iPhone 5 的原生尺寸:
Screen bounds: {{0, 0}, {414, 736}}, Screen resolution: <UIScreen: 0x7f97fad330b0; bounds = {{0, 0}, {414, 736}};
mode = <UIScreenMode: 0x7f97fae1ce00; size = 1242.000000 x 2208.000000>>, scale: 3.000000, nativeScale: 3.000000
iPhone 6 和 iPhone 6S 的尺寸,@2x 缩放(Apple 名称:Retina HD 4.7),坐标空间: 375 x 667 点和 750 x 1334 像素,326 ppi,屏幕物理尺寸为 2.3 x 4.1 英寸或 58 x 104 毫米。在缩放模式下运行时,即没有新的 LaunchImages,屏幕为 320 x 568 点,这是 iPhone 5 的原生尺寸:
Screen bounds: {{0, 0}, {375, 667}}, Screen resolution: <UIScreen: 0x7fa01b5182d0; bounds = {{0, 0}, {375, 667}};
mode = <UIScreenMode: 0x7fa01b711760; size = 750.000000 x 1334.000000>>, scale: 2.000000, nativeScale: 2.000000
而 iPhone 5 是 640 x 1136,iPhone 4 640 x 960。
这是我用来检查的代码(请注意,nativeScale 仅在 iOS 8 上运行):
UIScreen *mainScreen = [UIScreen mainScreen];
NSLog(@"Screen bounds: %@, Screen resolution: %@, scale: %f, nativeScale: %f",
NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale);
注意:上传 LaunchImage 否则应用程序将在缩放模式下运行,并且不会显示正确的缩放比例或屏幕尺寸。在缩放模式下nativeScale 和scale 将不一样。 在实际设备上,iPhone 6 Plus 上的比例可以是 2.608,即使它没有在缩放模式下运行,但它会显示在模拟器上运行时的规模为 3.0。