How to support both iPad and iPhone retina graphics in universal apps - iphone

Apple presented new iPad that support retina graphics.
I saw this link retina graphic in apple apps. As you can see apple just use "#2x" suffix for retina iPad display.
I have an universal app. So how to support retina in new iPad and iPhone? Will iPad retina use suffix "#2x" similar to iPad?

I just created a test app and tested.
So for devices without retina:
ImageName.png - For iPhone/iPod
ImageName~ipad.png -- For iPad
For devices with retina display:
ImageName#2x.png - For iPhone/iPod
ImageName#2x~ipad.png -- For iPad
And you can still use #2x if your iPhone high resolution image and iPad high resolution image have the same size.
To load the image just use [UIImage imageNamed:#"ImageName.png"];
I just tested it on iOS simulator for iOS 5.1, 5.0 and 4.3.
By the way why you should use #2x and nothing more.
The main thing because you shouldn't use the same graphics on iPhone and iPad, because iPhone and iPad has different size. And if you will use the same size the graphics will already done for you iPad retina display (if you previously use iPhone retina display). If you will images with different size, so you will use different image names for iPhone and iPad. So in this side you need just add #2x suffix.
That's why you should use just #2x suffix. - these are my thoughts.

I found that the iPad mini/non retina iPad hardware, not simulator, would fall back on ImageName.png, not ImageName~ipad.png as you would expect from rowwingman's answer.
Looking at the docs, referenced in another StackOverflow question by Nate, it seems as though appending the device to iphone images is the correct way to do it.
MyImage.png - Default version of an image resource.
MyImage#2x.png - High-resolution version of an image resource for devices with Retina displays.
MyImage~iphone.png - Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays.
Image, Sound, and Video Resources

Related

iOS7 App Submission - with only 2x (retina) images?

I'm currently developing an application for iPhone with iOS7, only.
From what I read, for iPhone with iOS7, there is no support for older devices than iPhone4.
If that's the case, when it comes to images, all I need is retina images (#2x).
Can I submit to the App Store, an app with only retina images, since the app's minimal requirement is retina devices ?
Thank you.
Possible duplicate of Can I dump my non-Retina Images for a iOS7 only app?
Anyway, as long as I know you don't need #2x version of your images as long as you don't support old displays, but remember that your images as to be double width and height, then if you have a 100x100px UIImageView, you need to load a 200x200px image to meet retina resolution.
EDIT: To explain in deep.
Actually, iPad 2 and iPad mini 1st generation run iOS 7 and doesn't have retina display. Anyway using #2x images it is not mandatary. You can just use double size images and set your UIImageViews' contentMode to UIViewContentModeScaleToFill to fit your needs.
PROS -> smaller bundle
CONS -> worst performaces

Cocos2d and iPhone 5 Retina Support?

I would like to know how to include retina images for the iPhone 5 in cocos2d. I already have large images from the iPad version of the game. How do I do that ? Unfortunately there is not very much information on the internet, so I thought I'll ask here. I do not have a working iPhone version of the game yet.
This is built into cocos2d. Use xxx.png for standard resolution image, then provide a xxx-hd.png image and cocos2d will use that high-res version on Retina devices (including iPhone 5).
The file suffixes for iPad are -ipad and -ipadhd for Retina iPads.

Sharp images in iPhone app but grainy images in iPad app

We're using retina images in our iPhone app (i.e., double the size).
The images render great on an iPhone 4 -- sharp and crisp. However, for the same app, the images look grainy on an iPad when run in "1x" mode (i.e., iPhone app size).
The code is exactly the same for both apps. There is no iPad version. People just download the iPhone version on iPads.
Are we supposed to use different images for the iPad?
Here is the app: http://itunes.apple.com/app/dumpling/id514239919
If you download it on an iPhone and then again on an iPad, you'll see the difference.
If the app is not universal then they are rendering the iPhone version on the iPad. I'm assuming you aren't in "2X" mode so if you are on an iPad 1 or 2 your app would not be using the retina graphics so it'll look grainy. Have you tested this on an iPad 3? This should render correctly for you with the #2x images.

iOS4 SDK and iPad and #2x images

If I provide an image in both the standard size and now a new one with #2x for iPhone 4, which one with the iPad use? If the user chooses the 2X feature to run the iPhone app in full screen on the iPad, do they seem the lower quality images stretched or will they see the higher quality images?
The lower quality images, at least in OS 3.2, which is pre-iPhone 4.
When iPad is updated to 4.x this might change.

Is there any difference between iPad 2x mode and iPhone4 Retina display (for developer)?

Graphics development for iPhone4 and old iPhones was changed in several ways:
The concept of point was introduced
to replace pixel.
Methods of UIImage will load high
resolution resource files with #2x
in the file name.
Scale factor was added to UIScreen,
UIView, UIImage, and CALayer
classes.
So if we handle CGImage carefully, it's not hard to support the high resolution Retina display of iPhone4.
I have several questions about non-native iPad app in iPad 2x mode:
Could all the changes from old
iPhone to iPhone4 (#2x resources
auto loading, point concept, scale
factor) be applied to iPad 2x mode.
The scale of app on iPad can be
changed. How can I handle it?
With The new iPad sporting Retina Display you will need another set of images for some items such launcher icon, launch images (splash screen).
For example:
The launcher icon for Retina Display on iPhone/iPod Touch is 114 x 114 but on The new iPad the same icon for Retina Display is 144 x 144.
Other example:
On an Universal App, for the launch images (splash screen) you'll need an image set for phones/music players:
Default.png (For old devices)
Default#2x.png (For phones/music player with retina display)
Another image set for Tablets:
Default-Portrait~ipad.png (For original iPad and iPad 2)
Default-Portrait#2x~ipad.png (For the new iPad with retina display)
Default-Landscape~ipad.png
Default-Landscape#2x~ipad.png
The "#2x~ipad" will work on the new iPad in the same way "#2x" worked for the phones and ipods, but will be relative to the old iPad image set.
Unfortunately, all of those content scale functions were added in 4.0, so I don't think there's any way to use the iOS4 stuff that you're asking for.
The iPad 2x mode is just a way to run iPhone-only apps on the iPad's larger screen. If you want to take advantage of iPad's larger screen, all you have to do is create a universal binary (i.e. one that contains views for both iPhone and iPad).
There is no way to get the iPad 2x mode to display your iPhone retina level content automatically—Apple do not support this... presumably as they want people to put effort into developing iPad-specific interfaces for their apps.