My app have a background image that fills the screen. I’d like to display the correct .png file depending on if we’re on a Retina Display device or not. I already have added all the .png files for both iPhone and iOS with the correct sizes. Is it possible ? If not, how should I handle it properly ?
I have XCode 4.3.2 with iOS 5.1 as the deployment target.
If you name your graphics properly (e.g. add “
@2x” to the suffix of the png files), iOS is smart enough to use your Retina display graphics on the appropriate devices & displays. Especially if you are using UIImageViews or controls or whatever, within your user interfaces designed within XIB files.If you’re doing programmatic images (i.e. where you define an outlet and then grab an image via something like “
[UIImage imageNamed:], iOS is still smart enough to pick up the high rez images for you. Again, provided you named your graphics properly.There are other questions here on StackOverflow that might help you out, such as:
How to support both iPad and iPhone retina graphics in universal apps
How to activate @2x high res graphics for retina display?