-1

Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?

I have two sets of images.One set of images to iphone 4 background images and other set of images to iphone 5.How can I use these two image sets to create my iphone application which wants to be compatible with both screen sizes ? do I want to check the iphone version and apply images using some coding ? Hope you can help.Thanks for the help.

Community
  • 1
  • 1
harshiYL
  • 251
  • 2
  • 4
  • 13

2 Answers2

0

I am using a class extension called UIDevice. You can find the source here: https://github.com/erica/uidevice-extension

I have set up a neat little method which layouts the view according to screen size. Example:

- (void)setupGUI
{  
    UIImage *backgroundImage;
    if ([[UIDevice currentDevice] platformType] == UIDevice5iPhone)
    {
        //4 inch screen
         backgroundImage = [[UIImage alloc] initWithCGImage:[UIImage imageNamed:@"main_background-568h@2x"].CGImage scale:2.0 orientation:UIImageOrientationUp];
    }
    else
    {
        //3.5 inch screen

        backgroundImage = [[UIImage imageNamed:@"main_background"] retain];
    }
    self.view.backgroundColor = [UIColor colorWithPatternImage:backgroundImage];
    [backgroundImage release];
}
Majster
  • 3,611
  • 5
  • 38
  • 60
0

For the splash you can use the suffix -568h@2x

For UIImage you can use:

[UIImage imageNamed:@"tryImage"]

And you can have tryImage.png, tryImage@2x.png and tryImage-568h@2x.png, but it seems not to be working as we would like.

You can also use a trick like this: https://gist.github.com/3782351

ppaulojr
  • 3,579
  • 4
  • 29
  • 56
  • Thanks for your reply, :) Yes,I have these 3 types of background images(tryImage.png,tryImage@2x.png,tryImage-568h@2x.png).If I'am using ios6 version to create my app,Then When I get a new xib, I am getting a view which has 568 of screen height.So, still do I want to use tryImage.png as default background of that view or do I need to use tryImage-568h@2x.png ? – harshiYL Nov 20 '12 at 14:22
  • I have got a new xib and I have added an imageView which has the same height as its view(568) and I have used tryImage.png as its background image.Is it correct ? – harshiYL Nov 20 '12 at 14:31