0

I am completely new to iOS i am developing an app which is compatible with iPhone 5 also i want to apply background image to view my question is that should i need two different images of both sizes????

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    CGSize result = [[UIScreen mainScreen] bounds].size;
    if(result.height == 480)
    {
        // iPhone 4S background view
    }
    if(result.height == 568)
    {
        // iPhone background image

    }
}
Hemang
  • 26,840
  • 19
  • 119
  • 186
  • Well usually you do not do this manually but let the OS do the work - see http://stackoverflow.com/questions/9611061/how-to-support-both-ipad-and-iphone-retina-graphics-in-universal-apps – Michael Rose Apr 08 '13 at 10:34

1 Answers1

3

Say you've background.png for app background, now to support retina devices you should have an exact double size of background.png that will be added as background@2x.png in your project folder. The selection of normal or retina image will be handled by iOS itself based on which device you've!

Okay, now for iPhone 5 device which height is not equivalent to iPhone 3G, 4, 4S you need background.png of 640(width)*1136(height), as iPhone 5 only supports retina images. For that you need to include background-568h@2x.png to differentiate it from other files.

An example of splash screen,

Default.png --- Normal devices, iPhone 3G

Default@2x.png --- Retina devices, > iPhone 3G

Default-568h@2x.png --- Retina devices only, > iPhone 4S

It will select specific splash screen automatically!

Hemang
  • 26,840
  • 19
  • 119
  • 186