How to support iPad and iPhone setting graphics in universal applications

Apple introduced a new iPad that supports retina graphics.

I saw this link with graphics in Apple apps . As you can see, the apple simply uses the suffix "@ 2x" to display the iPad in the retina.

I have a universal application. So, how to support the retina in the new iPad and iPhone? Will the iPad Retina use the suffix "@ 2x", similar to the iPad?

+69
ios iphone ipad retina-display
Mar 07 2018-12-23T00:
source share
2 answers

I just created a test application and tested.

So, for devices without a retina:
ImageName.png - for iPhone / iPod
ImageName~ipad.png - for iPad

For devices with a retina display:
ImageName@2x.png - for iPhone / iPod
ImageName@2x~ipad.png - for iPad

And you can still use @ 2x if your iPhone's high-resolution image and iPad's high-resolution image are the same size.
To upload an image, just use [UIImage imageNamed:@"ImageName.png"];
I just tested it on an iOS simulator for iOS 5.1, 5.0 and 4.3.
By the way, why should you use @ 2x and nothing else.

The main thing is because you should not use the same graphics on iPhone and iPad, because iPhone and iPad are of different sizes. And if you use the same size, graphics will already be made for your iPad retina display (if you've previously used the iPhone retina display). If you have images of different sizes, you will use different image names for the iPhone and iPad. So on this side, you just need to add the @ 2x suffix. This is why you should only use the @ 2x suffix. - these are my thoughts.

+138
Mar 08 2018-12-12T00:
source share

I found that iPad iPad / iPad is not an iPad simulator, not ImageName ~ ipad.png, as you would expect from a rolingingman answer.

Looking at the docs , referring to another question on https://stackoverflow.com/a/4646268/39867 on Nate , it seems that adding a device to the iphone is the right way to do this.

MyImage.png is the default version of the resource image.

MyImage@2x.png . High quality image resource for devices with Retina displays.

MyImage ~ iphone.png - image version for iPhone and iPod touch.

MyImage@2x~iphone.png is the high-resolution version of the iPhone and iPod touch with Retina displays.

Image, Sound, and Video Resources

+6
Aug 06 '13 at 16:46
source share



All Articles