Can we use just one set of image assert for all resolutions in iOS Development

408 Views Asked by At

I just want to use one set of image asserts for all iPhones and iPads(Universal), Is it possible to do the same? or what will be the best solution for the making a build lighter.

2

There are 2 best solutions below

2
On

YES, it is possible ti use one image asserts for all devices. just add new image set

in assert by Right click. And the add images for required devices in created Image set.

you can use Image set but it's name,and images are automatically loaded with different devices.

UPDATED

if you want to titlelogo.png for all device then make new image set in Images.xcassets and name it as AssetTitlelogo. and the add all images in it as in screenshot.img

You use image by

[UIImage imageNamed:@"AssetTitlelogo"]; /// use your asset Name

It's load right image for right Device..

1
On

Yes, if you use a retina image without the @2x or @3x in the name and your UIImageView is set to ScaleToFill it will automatically scale down your image on non-retina devices. it is easy to test with the simulators to see how the image will look at the different screen resolutions.

the trade off is non retina devices will suffer with more memory usage than is needed for them (and usually the non-retina devices are some what limited in memory already compared to the latest apple products) but if you arent dealing with a lot of images on the screen at once then this shouldnt have an adverse effect