0
votes

I would like to know what size should be an image that I want to use for background on an iOS app. My application will be only in portrait. The thing is that my image is not a simple image like that

enter image description here

Instead I have an image that I don't want to be catted from the navbar and the tabbar. Something like that:

enter image description here

My Question is: what are the correct sizes for this image in order to look ok on iphone, iphone4 AND iphone5 and how xCode will know which image must use? What are the names that I must use. If I use background.png [email protected] then iphone4 and iphone5 with retina screens are going to use the [email protected] But iphone5 has bigger height. Can someone help me to understand?

UPDATE

the solution: I used for iphone5 the size 320x455 for the image with name Default-568h.png and 640x910 for the image with name [email protected]. For all the other iphone devices is 320x367 for the image with name Default.png and 640x734 for the image [email protected]. Then I used this code on the viewDidLoad:

#define IS_iPhone5 ([[UIScreen mainScreen] bounds].size.height == 568)
    if (IS_iPhone5)
{
    UIImageView *backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default-568h.png"]];

    [self.view addSubview:backgroundImage];
    [self.view sendSubviewToBack:backgroundImage];

        }
else
{
    UIImageView *backgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];

    [self.view addSubview:backgroundImage];
    [self.view sendSubviewToBack:backgroundImage];

}
1

1 Answers

1
votes
#define IS_iPhone5 ([[UIScreen mainScreen] bounds].size.height == 568)

 if (IS_iPhone5)
    {
        self.backGroundImageView.image = [UIImage imageNamed:@"Default-568h.png"];
        self.backGroundImageView.frame = CGRectMake(0, 0, 320, 568);
    }
    else
    {
        self.backGroundImageView.image = [UIImage imageNamed:@"Default.png"];
        self.backGroundImageView.frame = CGRectMake(0, 0, 320, 480);
    }