I have an image that I would like to display in my iOS app. To conserve memory, I would like to display the lowest possible resolution that still matches the number of physical pixels on the device
For example, could be displayed as a square 1/4 the height of the device. So the sizes would be as follows
iPhone 4s 240x240 px
iPhone 5/5s 284x284 px
iPhone 6 334x334 px
iPhone 6+ 480x480 px
I've looked into asset catalogs, but I don't see any way to have a different image for iPhone 4s, iPhone 5/5s, and iPhone 6 (they are @2x
). The only difference is iPhone 6+ (@3x
).
I've also tried adding the Retina 4 2x
option, but that only gives a different icon for the iPhone 5/5s - there is still no way to differentiate between 4s and 6.
I understand that I could choose the image programmatically based on the device, but asset catalogs only downloads the necessary images to the users device (not sure if that is true, I remember reading something about it, though), making the application take up less storage. It would be inefficient to include four images, if only one will be used.
Is there any way to use a different image resolution for every iOS device with a different amount of physical pixels?
Note that I'm not asking about scaling the image, but about getting the correct resolution used (a different image for every device), so less RAM will be taken when it is displayed.