IOS 8 asset catalog image sizes confusing

2019-06-13 19:26发布

问题:

Say I want to make a button that takes up half the width of the iPhone screen (portrait) at @1x. This would be 160 pixels, @2x this would be 320 pixels.

Now with iPhone 6 and iPhone 6 plus it gets confusing. The iPhone 6 has 750 pixels width and uses @2x but the asset catalog has only one box for adding @2x images, so do I make my image 320 pixels or 375 pixels?

Also, the iPhone 6 Plus has width of 1080 pixels or 1242 pixels (any idea which one?), but my standard image of 160 pixels multiplied by 3 = 480 pixels but half the iPhone 6 Plus screen is either 540 pixels or 621 pixels??

What size I should be making my images and why?

回答1:

The iPhone 6 and 6 Plus have the same aspect ration as the iPhone 5/5C/5S, so they automatically scale the image for your screen. For the iPhone 6, your image should be 320 pixels, just like with a 4-inch screen.

For the 6 Plus, you should make it 480 pixels for the same reason.