iOS #2x images conflicting - ios

I've a little confusion and facing a little problem regarding #2x images in iOS as according to Human Interface Guidelines HIG, the #2x For iPhone 6: 750 x 1334 (#2x) for portrait but same #2x for iPhone 4S has size of 640x1136.
HIG
When I placed #2x image named as MyTestImage#2x.png of size 750 x 1134, it was fine for iPhone 6 but not for iPhone 4S, but if I put MyTestImage#2x.png of size 640x1136 then its fine for iPhone 4S but not for iPhone 6.
I also placed 640x1136 as Retina 4 2x named as MyTestImage-568h#2x.png but its also not working for me.
Whats I'm conflicting? What should be the actual image sizes of #2x for iPhone 4S and iPhone 6 if I talk about a full screen image.
And also what should be the correct retina display image size.
EDIT 1:
My question is different as I want to know the difference between #2x and -568h#2x retina display regarding both screens. Also, any optimal solution for this which can avoid image redundancies.

Related

Big size image is not showing in ios big resolution screen like ipad

I have already added all images in three format like test.png, test#2x.png, test#3x.png for IOS in resources folder, still on big resolution screen like ipad it shows default one test.png.
I am not getting why this is happening. Am I missing something from code side.
EDIT :
sorry my mistake. my question was wrong.it shows different image but in small size.
i tried 3 different images with same name having #2x,#3x extension. so i come to know that in ipadPro(9.7 inch) it shows #3x image while in iphone5(which lowest screen resolution simulator in my mac) it shows # 2x image.
so how could we decide which screen resolution will take which image?and how can we decide their size.?
Depending on the device, you accomplish this by multiplying the number of pixels in each image by a specific scale factor. A standard resolution image has a scale factor of 1.0 and is referred to as an #1x image. High resolution images have a scale factor of 2.0 or 3.0 and are referred to as #2x and #3x images.
Suppose you have a standard resolution #1x image that’s 100px x 100px, for example. The #2x version of this image would be 200px × 200px. The #3x version would be 300px × 300px.
iPhone X, iPhone 8 Plus, iPhone 7 Plus, and iPhone 6s Plus support 3x
resolution. iPhone 8, iPhone 7, iPhone 6/6s and iPhone 5s/5c support 2x
resolution. All other iPhone devices support 1x resolution.
Consider following sample set of images for view with size 10 points and how do iOS system selects device resolution specific image.
#3x -> 3 * (10px x 10px) = (30px x 30px) // iPhone X, iPhone 8 Plus, iPhone 7 Plus, and iPhone 6s Plus
#2x -> 2 * (10px x 10px) = (20px x 20px) // iPhone 8, iPhone 7, iPhone 6/6s and iPhone 5s/5c
#1x -> 1 * (10px x 10px) = (30px x 30px) // All other iPhone devices
Note: You don't need to do any code (setup) to assign device resolution specific images. Just add images for all (1x, 2x and 3x) types of resolution in your image set. iOS system automatically chooses/selects device resolution specific image from the set of image.
Look at this document of Apple: Image Size and Resolution
Here is nice tutorial for easy understading: DESIGNING FOR THE NEW IPHONE SCREEN RESOLUTIONS

Iphone6 and Iphone 6Plus Resolution #x2/#x3

I've a question about resolution of Iphone 6 and Iphone 6 Plus.
I would like to know something about #x2 and #x3, i really need to be sure !
If i've a fullscreen UIImageView, display on a Iphone 6(667x375 points) the size of the containing UIImage have to be 1334x750 because the size in points are 667(#x2)x375(#x2), right?
So if i understand, the UIImageView on Iphone 6Plus in fullscreen is 736x414 but the resolution is #x3 then the UIImage in the UIImageView have to be 2208x1242 because the size in points is 736(#x3)x414(#x3), no ?
Then in a general case, i only need to know what is the size of my UIImageView and if the resolution is #x2 i multiply the size x2 and if the resolution is #x3 multiply the size x3?
Guys i really need a confirmation and if i'm wrong, please, explain me why !
I'm sorry if you think my question is really stupid but i need to understand how it works.
Cordially :)
Lets go for a ride of #1x, #2x and #3x image scaling and content viewer size according to different resolutions in iPhone.
Let understand some basics first
Device Resolution
================================
iPhone 4 & 4S 640×960
iPhone 5, 5C & 5S 640×1136
iPhone 6s 750×1334
iPhone 6P 1242×2208
Resolution reference from this site.
Now if how to use images with #1x, #2x & #3x.
Lets say you have an imageView in with size of 100W x 100H, to display images properly on all the devices with appropriate resolution without stretching or pixelation your image, one need to create 3 set of images as below according to device.
iPad 2, iPad mini supports #1x images, required image of size 100x100(WxH)
iPad, iPad mini supports #2x images, required image of size 200x200(WxH)
iPhone 4S, 5 & 6 supports #2x images, required image of size 200x200(WxH)
iPhone 6P supports #3x images, required image of size 300x300(WxH)
Though your UIImageView size is 100x100 for all the devices, but image displayed in different devices is different according to their resolutions.
Following size Table will give you more clarification, read more about it in apple documentation here
I hope it clears confusion about different resolution images for different devices :)

Understanding image sizes in Xcode

I apologise if this has been answered but I can't seem to understand no matter where I look. I have been trying to make a Chess game using SpriteKit in Xcode. I don't understand the 1x, 2x and 3x options in the assets folder.
It seems like the image is the smallest when I put it in 3x, which seems counter-intuitive. Also, what resolution is best to design for? It doesn't seem like the actual iPhone resolutions are used in the iOS simulator.
Thanks
You get a great overview from apples docs:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
Basically, you need images with higher resolution for devices with higher resolution. If an icon is 32x32 pixel for iphone 3, you add an 64x64 image for iphone 4 (retina, #2x) and an 96x96 image for iphone 6 (even higher resolution, #3x).
1x , 2x , 3x is different size of images according to different phone's resolution.
You can find imagesize according to device resolution in below link.
IconMatrix
Basically,
#1x images are for the iPhone 3GS - 'standard' resolution devices (3.5" screens)
#2x images are for the iPhone 4 and 4S which contain 3.5" Retina screens and also used for the iPhone 6.
Retina 4 #2x are for the iPhone 5 and 5s (4" Retina screens)
#3x images are for the new iPhone 6+,iPhone 6S+ (5.5" super-Retina [3x] screen)
Note :- As describe by apple in document
For all images and icons, the PNG format is recommended
Also, what resolution is best to design for?
The biggest resolution you will need. In most cases, #3x. So if the image "is" 10x10, design it being 30x30 for the #3x files, and scale down to smaller resolutions.
• 30x30 is the pic#3x.png
• 20x20 is the pic#2x.png
• 10x10 is the pic.png
The simulator uses the image according to the device it is simulating. So the iPhone 6S+ will use #3x if available.
PNG is the recommended extension, and you can use http://tinypng.com to reduce the file size, including splash screens.

iPhone5 and iPhone 6 images suffix?

We are trying to make an app for all devices ,designing it on code only.
I could see that the suffix are :
#2x~ipad for ipad retina
#2x for iphone5 and iphone6
#3x for iphone6+
But there is something that i dont get, how is that the files for iPhone5 and 6 have the same suffix and the same name ? these images should be in a different size, and so you cant give them the same name ?
We have created images for iPhone6 with #2x and they seems great on the iPhone6 simulator, but on iPhone5 things dont look good and cover each other .
Cant you separate these files with a different suffix?
I have read this :
Image resolution for new iPhone 6 and 6+, #3x support added?
It is because iphone 5 and iphone 6 (not including the plus) have the same pixel density.
So basically a 40x40 image will look the same on both screens and will take the same space. You will just have to adjust positions to cover for the extra space on the iphone 6 screen.
Images for the iPhone 5 and iPhone 6 are the same size, and the same DPI. So they share the same suffix (#2x). They don't need to be separated.
#3x is for the iPhone 6+ because it has a higher DPI and a larger size than the other phones. Please refer to the Human Interface Guidelines for Images.
You should be using layout to determine how your UI elements are laid out on the screen, and you should be using Auto Layout to make sure they look right on all devices, independent of aspect ratio.
The #2x, #3x image sizes refer to device families grouped by resolution. iPhone 5 and 6 are in the same family, and iOS will use the #2x image for both. The size and placement of the UI element which uses that image, however, has nothing to do with the size of the image itself.

Image Sizes for Supporting iPhone 4S,5,5C/S,6 and 6+

I want to support a variety of devices from iPhone 4S to iPhone 6+. Previously, when adding supporting for iPhone 5, we followed the following steps.
Add the launch Default-568h#2x.png
Use the same #2x images (640x960) which are resized automatically for iPhone 5.
Now, iPhone 6 and 6+ are introduced with varying sizes and it is written on most blogs that we will use #2x for iPhone 6 and #3x identifier for iPhone 6+. It is also written that:
iPhone 6+ (#3x) images will have resolution of 1242x2208 (I am using portrait mode), and it is automatically downsized.
iPhone 6 will use #2x images.However,I am not sure what the size of these images should be. Should they be 640x960 or 640x1136 or 750 x 1334. In case of using the first two sizes, won't the images be distorted?
I think what you are after is detailed in the HIG under "Icon and Image Sizes"
https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1

Resources