xcode - asset catalog - image type - same scale - different resolutions

I have an iOS application which is developed years ago and sets backgrounds of many controls using images.xcassets catalog. The images are set using contents.json in which targets are iPhone, iPad using 'idiom' key. Further specifications include 'scale' & 'filename'. Seems that this app worked fine until iOS 8.


As of today there are many high screen resolution devices of iPhone, iPad. So, I need to add further more images targeting these high screen resolution devices.


I don't know how it is handled earlier, but now there are different screen resolutions in the same scale factor. For e.g., iPad Pro 12.9" & iPad Pro 11" have '2x' as scale factor but has different resolutions '2048x2732' & '1668x2388' respectively. Now if I create an image targeting highest resolution 2048x2732, the image is not getting centered for resolution 1668x2388.


  1. Is there any particular key in contents.json that can differentiate screen resolutions/sizes for the same scale factor?
  2. When I search for Apple's documentation for asset catalog it is found in this documentation archive. Does that mean we shouldn't use asset catalog for images any more? Are there any latest standards for setting background images?

Replies

You should first try a simple solution: copy the same image to 2x and 3x, by option-drag from 1x cell in xcAssets to 2x and 3x.

I didn't get. Why we need same image for 1x, 2x and 3x? My question is about an image for 2x but for different resolutions.

I understood your request about resolution as dezaling with normal, retina or super retina. So, my proposal was about that.


Did I misunderstand your question ?

Let me be more clear. I have an image set for background of a UIView which occupies around 80% of the screen. Let's take example of 3x scale factor for iPhone devices (I am using idiom "iphone" in image set's contents.json). The image is created for highest resolution 1242x2688 for iPhone XS Max. The image is having a logo in the center. When the app is opened in iPhone X which is also of 3x scale factor and having resolution 1125x2436 that is lower than iPhone XS Max, the image is not centered perfectly and the logo is touching the right edge of the screen. So, I just want to if there's any specific json key like 'subtype' for differentiating between iPhone X and iPhone XS Max so that I can use two different images in same image set? Or Do I need to use different imageset each for iPhone X and iPhone XS Max?