In my app I am using images of size 155*155pts so I am supplying it with an image of 310*310px resolution. I know that I can use image.png image@2x.png and image@3x.png and then [UIImage imageNamed: image] to select the image appropriate for the resolution. My question is do I really need to include a lower resolution version of size 155*155px, won't the UIImageView it's displayed in just scale it appropriately? A similar question for the iphone6+, if I don't include the @3x version will it just use the @2x and display it as clearly as a standard retina screen would?
-
if you don't support any non-retina iPad, the standard (`@1x`) image set can be bypassed – if you don't want to add the `@3x` set, the iOS8.1.1+ loads the `@2x` set, before that version the `@1x` set will be loaded for HD retina screens (but that was just a bug in earlier versions of iOS8, it has been fixed). – holex Mar 05 '15 at 12:50
2 Answers
Even though there are plenty of answers at SO discussing this topic
(Google them) e.g. How to handle image scale on all the available iPhone resolutions?
Its just a recommendation to to use scaled up images with @2x and @3x in your app. You don't have to create them. From my experience in making apps, in almost all of them I have never used multiple images. I create one UIImage and use it for all the phone sizes. I then either use auto layout or manually adjust the width height of UIImages myself.
There is a reason I do that is lets say one of your sample1.png image is 1MB then you will need to create 3 of them.
- sample1.png
- sample1@2x.png
- sample1@3x.png
You just doubled or tripled your binary size which is bad for downloads. There always be users running non-retina devices and it would be shame to not support them. Can you only make retina enabled apps, of course you can and Apple will approve those as they will be testing your apps on the latest devices but the best approach is to support all devices.
-
I know that it's best practice to include all the image sizes but for my app it will be difficult as the images I use are downloaded off a server so can't use [UIImage imageNamed: ]. What about if I don't supply a @3x version of the image? My UIImageView size is 155*155 and the image I supply is 310*310 will it just display it as a standard retina graphic or will it try and scale it up to @3x? – KeXMeX Mar 05 '15 at 13:04
-
If your UIImageView is set to ScaleToFit then it will automatically adjust the 310x310 image in it. To be honest most users including yourself won't be able to tell the difference between 2x or 3x image in that UIImageView. Try in Xcode simulator and see for yourself. – Sam B Mar 05 '15 at 13:06
-
6+ is 3pixels per point so will it enlarge the image for the UIImageView? – KeXMeX Mar 05 '15 at 13:08
-
No nothing will get enlarged as iOS will automatically try to adjust it within the UIImageView's frame – Sam B Mar 05 '15 at 13:14
-
but the UIImageView frame is fixed to 155*155 pts and the image is 310*310px. Doesn't it want a 465*465px to fit the 3 pixels per point so will enlarge the image? – KeXMeX Mar 05 '15 at 13:23
It depends, if you only support non-retina devices you don´t have to add the normal image size anymore. The scaling for the 6+ works with the @2x images but i guess you will see a quality difference

- 1,856
- 19
- 21