ChatGPT解决这个技术问题 Extra ChatGPT

iPhone 6 Plus resolution confusion: Xcode or Apple's website? for development

Apple's website claims that the resolution is 1080p: 1920 x 1080

However, the launch screen required by Xcode (8.0 GM launched today) is 2208 x 1242.

Who's right?

https://i.stack.imgur.com/Sx7Ig.png

The launch images for the iPhone 6+ must be 1242x2208 and 2208x1242. At least this makes apps work properly in the simulator (and this is documented in the HIG). I haven't figured out why this is different from the supposed physical screen size of 1920x1080.
very strange discrepancy.
This might change in stable version of Xcode 6.1. Is it?
To update the link from Andreas, see the "Ultimate Guide to iPhone Resolutions" paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions

C
Community

The iPhone 6+ renders internally using @3x assets at a virtual resolution of 2208×1242 (with 736x414 points), then samples that down for display. The same as using a scaled resolution on a Retina MacBook — it lets them hit an integral multiple for pixel assets while still having e.g. 12 pt text look the same size on the screen.

So, yes, the launch screens need to be that size.

The maths:

The 6, the 5s, the 5, the 4s and the 4 are all 326 pixels per inch, and use @2x assets to stick to the approximately 160 points per inch of all previous devices.

The 6+ is 401 pixels per inch. So it'd hypothetically need roughly @2.46x assets. Instead Apple uses @3x assets and scales the complete output down to about 84% of its natural size.

In practice Apple has decided to go with more like 87%, turning the 1080 into 1242. No doubt that was to find something as close as possible to 84% that still produced integral sizes in both directions — 1242/1080 = 2208/1920 exactly, whereas if you'd turned the 1080 into, say, 1286, you'd somehow need to render 2286.22 pixels vertically to scale well.


How did you calculated it-> "virtual resolution of 2208×1242 (with 736x414 points)" and this "need roughly @2.46x assets" What will UIScreen mainScreen].bounds.size.height will return for 6+? 568, 568*3 (1704) or 1920.
Perhaps add a note to this answer about launch images? (see Hannes's answer) Useful to bear in mind for existing apps being upgraded (otherwise it runs at 320x576 @3x - I was confused for a while!)
@msk [UIScreen mainScreen].bounds.size.height returns 736 in the iPhone 6+ simulator when in portrait. This is the 2208 value divided by the scale of 3. The width is 414.
It is not exactly the same size with @3x with the resolution 1242*2208, it is 6% streched.
What a horrible kludge! A system-wide loss of performance and memory and sharpness just to make some API-level size adjustments slightly simpler! Well I guess it will all make sense when they release the iPhone 7 Plus with a 5.5" 461 ppi display.
S
Sverrisson

The answer is that older apps run in 2208 x 1242 Zoomed Mode. But when an app is built for the new phones the resolutions available are: Super Retina HD 5.8 (iPhone X) 1125 x 2436 (458ppi), Retina HD 5.5 (iPhone 6, 7, 8 Plus) 1242 x 2208 and Retina HD 4.7 (iPhone 6) 750 x 1334. This is causing the confusion mentioned in the question. To build apps that use the full screen size of the new phones add LaunchImages in the sizes: 1125 x 2436, 1242 x 2208, 2208 x 1242 and 750 x 1334.

Updated for the new iPhones 12, 12 mini, 12 Pro, 12 Pro Max

Size for iPhone 12 Pro Max with @3x scaling, coordinate space: 428 x 926 points and 1284 x 2778 pixels, 458 ppi, device physical size is 3.07 x 6.33 in or 78.1 x 160.8 mm. 6.7" Super Retina XDR display.

Size for iPhone 12 Pro with @3x scaling, coordinate space: 390 x 844 points and 1170 x 2532 pixels, 460 ppi, device physical size is 2.82 x 5.78 in or 71.5 x 146.7 mm. 6.1" Super Retina XDR display.

Size for iPhone 12 with @2x scaling, coordinate space: 585 x 1266 points and 1170 x 2532 pixels, 460 ppi, device physical size is 2.82 x 5.78 in or 71.5 x 146.7 mm. 6.1" Super Retina XDR display.

Size for iPhone 12 mini with @2x scaling, coordinate space: 540 x 1170 points and 1080 x 2340 pixels, 476 ppi, device physical size is 2.53 x 5.18 in or 64.2 x 131.5 mm. 5.4" Super Retina XDR display.

Size for iPhone 11 Pro Max with @3x scaling, coordinate space: 414 x 896 points and 1242 x 2688 pixels, 458 ppi, device physical size is 3.06 x 6.22 in or 77.8 x 158.0 mm. 6.5" Super Retina XDR display.

Size for iPhone 11 Pro with @3x scaling, coordinate space: 375 x 812 points and 1125 x 2436 pixels, 458 ppi, device physical size is 2.81 x 5.67 in or 71.4 x 144.0 mm. 5.8" Super Retina XDR display.

Size for iPhone 11 with @2x scaling, coordinate space: 414 x 896 points and 828 x 1792 pixels, 326 ppi, device physical size is 2.98 x 5.94 in or 75.7 x 150.9 mm. 6.1" Liquid Retina HD display.

Size for iPhone X🅂 Max with @3x scaling (Apple name: Super Retina HD 6.5 display"), coordinate space: 414 x 896 points and 1242 x 2688 pixels, 458 ppi, device physical size is 3.05 x 6.20 in or 77.4 x 157.5 mm.

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

Size for iPhone X🅁 with @2x scaling (Apple name: Super Retina HD 6.1" display), coordinate space: 414 x 896 points and 828 x 1792 pixels, 326 ppi, device physical size is 2.98 x 5.94 in or 75.7 x 150.9 mm.

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

Size for iPhone X🅂 and iPhone X with @3x scaling (Apple name: Super Retina HD 5.8" display), coordinate space: 375 x 812 points and 1125 x 2436 pixels, 458 ppi, device physical size is 2.79 x 5.65 in or 70.9 x 143.6 mm.

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

https://i.stack.imgur.com/ZENS1.jpg

Size for iPhone 6, 6S, 7 and 8 with @3x scaling (Apple name: Retina HD 5.5), coordinate space: 414 x 736 points and 1242 x 2208 pixels, 401 ppi, screen physical size is 2.7 x 4.8 in or 68 x 122 mm. When running in Zoomed Mode, i.e. without the new LaunchImages or choosen in Setup on iPhone 6 Plus, the native scale is 2.88 and the screen is 320 x 568 points, which is the iPhone 5 native size:

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

Size for iPhone 6 and iPhone 6S with @2x scaling (Apple name: Retina HD 4.7), coordinate space: 375 x 667 points and 750 x 1334 pixels, 326 ppi, screen physical size is 2.3 x 4.1 in or 58 x 104 mm. When running in Zoomed Mode, i.e. without the new LaunchImages, the screen is 320 x 568 points, which is the iPhone 5 native size:

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

And iPhone 5 for comparison is 640 x 1136, iPhone 4 640 x 960.

Here is the code I used to check this out (note that nativeScale only runs on iOS 8):

UIScreen *mainScreen = [UIScreen mainScreen];
NSLog(@"Screen bounds: %@, Screen resolution: %@, scale: %f, nativeScale: %f",
          NSStringFromCGRect(mainScreen.bounds), mainScreen.coordinateSpace, mainScreen.scale, mainScreen.nativeScale);

Note: Upload LaunchImages otherwise the app will run in Zoomed Mode and not show the correct scaling, or screen sizes. In Zoomed Mode the nativeScale and scale will not be the same. On an actual device the scale can be 2.608 on the iPhone 6 Plus, even when it is not running in Zoomed Mode, but it will show scale of 3.0 when running on the simulator.

https://i.stack.imgur.com/ANau4.jpg


I guess you didn't add the new launch image versions. That's probably why the app runs in "compatibility mode" and the screen bounds are the old 320x576 on both devices.
As soon as you do add the new launch image sizes, you get the correct (logical) screen bound sizes: 375x667 for the iPhone 6, and 414x736 for the 6+.
@DanielRinser Thanks for that. I will try it out.
@DanielRinser thanks for your input on startup images. I have updated the answer based on you input.
and what about assets for iPhone 4? How should them be named and how to put them on the assets catalog if there is no slot for them? Assets catalog has 3 slots for iPhone images: 1x, 2x and 3x. If 2x and 3x are for iPhone 6 and 6+ assets were do we put iPhone 4 assets, on 1x? I don't think so.
L
Leszek Szary

Real/physical iPhone 6 Plus resolution is 1920x1080 but in Xcode you make your interface for 2208x1242 resolution (736x414 points) and on device it is automatically scaled down to 1920x1080 pixels.

iPhone resolutions quick reference:

Device                        Points   Log. Res.  Sc. Real Res.  PPI  Ratio   Size
iPhone 12 Pro Max, 13 Pro Max 926x428  2778x1284  3x  2778x1284  458  19.5:9  6.7"
iPhone 12, 12 Pro, 13, 13 Pro 844x390  2532x1170  3x  2532x1170  460  19.5:9  6.1"
iPhone 12 mini, 13 mini       812x375  2436x1125  3x  2340x1080  476  19.5:9  5.4"
iPhone XS Max, 11 Pro Max     896x414  2688x1242  3x  2688x1242  458  19.5:9  6.5"
iPhone XR, 11                 896x414  1792x828   2x  1792x828   326  19.5:9  6.1"
iPhone X, XS, 11 Pro          812x375  2436x1125  3x  2436x1125  458  19.5:9  5.8"
iPhone 6+, 6S+, 7+, 8+        736x414  2208x1242  3x  1920x1080  401  16:9    5.5"
iPhone 6, 6S, 7, 8, SE2       667x375  1334x750   2x  1334x750   326  16:9    4.7"
iPhone 5, 5S, 5C, SE1         568x320  1136x640   2x  1136x640   326  16:9    4.0"
iPhone 4, 4S                  480x320  960x640    2x  960x640    326  3:2     3.5"
iPhone 3GS                    480x320  480x320    1x  480x320    163  3:2     3.5"

https://i.stack.imgur.com/0jwdF.png


6 plus, 6s Plus is 375 x 667, your resolutions quick reference is wrong.
@dotrinh I'm quite sure it is correct and 375x667 is iPhone 6 (not 6 plus).
I debugged and check this Apple's page. developer.apple.com/library/archive/documentation/…
@dotrinh Very interesting. I do not have physical iPhone 6Plus however I'm quite sure it must be a bug on apple's page and ios simulator as suggested here developer.apple.com/forums/thread/108906 . Especially that on the same page Apple states that native scale factor for 6Plus is 2.608 same as for 7Plus which has the same physical resolution and size and also uikit scale factor (1080/2.608=414 and 1920/2.608=736). So it does not make sense that 6Plus would have different UIKit resolution than 7Plus.
E
Eneko Alonso

You should probably stop using launch images in iOS 8 and use a storyboard or nib/xib.

In Xcode 6, open the File menu and choose New ⟶ File... ⟶ iOS ⟶ User Interface ⟶ Launch Screen.

Then open the settings for your project by clicking on it.

In the General tab, in the section called App Icons and Launch Images, set the Launch Screen File to the files you just created (this will set UILaunchStoryboardName in info.plist).

Note that for the time being the simulator will only show a black screen, so you need to test on a real device.

Adding a Launch Screen xib file to your project:

https://i.stack.imgur.com/DMbdY.png

Configuring your project to use the Launch Screen xib file instead of the Asset Catalog:

https://i.stack.imgur.com/TktZk.png


Nearly perfect instructions, but it should be File -> NEW -> File... etc Took a while to find the second file :) Thanks for help!
How do you make these look good? When I try to put an image on it it gets very wonky.
If you not just displaying an image and you want to show the UI for loading then this is a good idea, as an image would still need to be in the appropriate sizes regardless of whether it was in a storyboard or not. Likewise if you can draw the image in code then you could get round that I suppose.
You still need to provide image files if you're supporting anything prior to iOS 8 as the launch xibs aren't backwards compatible.
M
Mustafa

On the physical device, iPhone 6 Plus's main screen's bounds is 2208x1242 and nativeBounds is 1920x1080. There is hardware scaling involved to resize to the physical display.

On the simulator, the iPhone 6 Plus's main screen's bounds and nativeBounds are both 2208x1242.

In other words... Videos, OpenGL, and other things based on CALayers that deal with pixels will deal with the real 1920x1080 frame buffer on device (or 2208x1242 on sim). Things dealing with points in UIKit will be deal with the 2208x1242 (x3) bounds and get scaled as appropriate on device.

The simulator does not have access to the same hardware that is doing the scaling on device and there's not really much of a benefit to simulating it in software as they'd produce different results than the hardware. Thus it makes sense to set the nativeBounds of a simulated device's main screen to the bounds of the physical device's main screen.

iOS 8 added API to UIScreen (nativeScale and nativeBounds) to let a developer determine the resolution of the CADisplay corresponding to the UIScreen.


P
Peter Mortensen

For those like me who wonder how legacy apps are treated, I did a bit of testing and computation on the subject.

Thanks to @hannes-sverrisson hint, I started on the assumption that a legacy app is treated with a 320x568 view in iPhone 6 and iPhone 6 plus.

The test was made with a simple black background bg@2x.png with a white border. The background has a size of 640x1136 pixels, and it is black with an inner white border of 1 pixel.

Below are the screenshots provided by the simulator:

iPhone 5 simulator : http://i.stack.imgur.com/b2E5K.png

iPhone 6 simulator : http://i.stack.imgur.com/4Qz8N.png

iPhone 6 plus simulator : http://i.stack.imgur.com/hQisc.png

On the iPhone 6 screenshot, we can see a 1 pixel margin on top and bottom of the white border, and a 2 pixel margin on the iPhone 6 plus screenshot. This gives us a used space of 1242x2204 on iPhone 6 plus, instead of 1242x2208, and 750x1332 on the iPhone 6, instead of 750x1334.

We can assume that those dead pixels are meant to respect the iPhone 5 aspect ratio:

iPhone 5               640 / 1136 = 0.5634
iPhone 6 (used)        750 / 1332 = 0.5631
iPhone 6 (real)        750 / 1334 = 0.5622
iPhone 6 plus (used)  1242 / 2204 = 0.5635
iPhone 6 plus (real)  1242 / 2208 = 0.5625

Second, it is important to know that @2x resources will be scaled not only on iPhone 6 plus (which expects @3x assets), but also on iPhone 6. This is probably because not scaling the resources would have led to unexpected layouts, due to the enlargement of the view.

However, that scaling is not equivalent in width and height. I tried it with a 264x264 @2x resource. Given the results, I have to assume that the scaling is directly proportional to the pixels / points ratio.

Device         Width scale             Computed width   Screenshot width
iPhone 5        640 /  640 = 1.0                        264 px
iPhone 6        750 /  640 = 1.171875  309.375          309 px
iPhone 6 plus  1242 /  640 = 1.940625  512.325          512 px

Device         Height scale            Computed height  Screenshot height
iPhone 5       1136 / 1136 = 1.0                        264 px
iPhone 6       1332 / 1136 = 1.172535  309.549          310 px
iPhone 6 plus  2204 / 1136 = 1.940141  512.197          512 px

It's important to note the iPhone 6 scaling is not the same in width and height (309x310). This tends to confirm the above theory that scaling is not proportional in width and height, but uses the pixels / points ratio.

I hope this helps.


C
Community

Check out this infographic: http://www.paintcodeapp.com/news/iphone-6-screens-demystified

It explains the differences between old iPhones, iPhone 6 and iPhone 6 Plus. You can see comparison of screen sizes in points, rendered pixels and physical pixels. You will also find answer to your question there:

iPhone 6 Plus - with Retina display HD. Scaling factor is 3 and the image is afterwards downscaled from rendered 2208 × 1242 pixels to 1920 × 1080 pixels. The downscaling ratio is 1920 / 2208 = 1080 / 1242 = 20 / 23. That means every 23 pixels from the original render have to be mapped to 20 physical pixels. In other words the image is scaled down to approximately 87% of its original size.

Update:

There is an updated version of infographic mentioned above. It contains more detailed info about screen resolution differences and it covers all iPhone models so far, including 4 inch devices.

http://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions


So even with anti-aliasing switched off there is non-optional anti-aliasing that goes on in the downscaling?
Had that infographic included 4 inch screen it would have been awesome.
@Rajesh I have updated my answer, check it now for info about 4 inch devices.
r
rawpower

Even if I don't generally like the tone of John Gruber's Daring Fireball blog, his Larger iPhone Display Conjecture is well worth the read.

He guessed but got exactly right both the resolution in points and in pixels for both models, except that he did not (me neither) expect Apple to build a smaller resolution physical display and scale down (details are in @Tommy's answer).

The gist of it all is that one should stop thinking in terms of pixels and start thinking in terms of points (this has been the case for quite some time, it's not a recent invention) and resulting physical size of UI elements. In short, both new iPhone models improve in this regard as physically most elements remain the same size, you can just fit more of them on the screen (for each bigger screen you can fit more).

I'm just slightly disappointed they haven't kept mapping of internal resolution to actual screen resolution 1:1 for the bigger model.


we think in points but unfortunately we have to create images in pixels on Photoshop... 😃
Pixels matter to many of us for many reasons. While Apple does their own thought policing on this topic, they begrudgingly added [UIScreen nativeBounds] in iOS8 for very good reasons.
Yeah, pixels are also important, but for static assets like images (splashscreens and such). My point (pun intended) was rather for application screen's layout, things drawn dynamically.