hacker
hacker

Reputation: 8957

Migrating to iphone5 not working?

I have an application in iPhone 4, working fine. Now i want to migrate it to 5. I have a startupviewcontroller for displaying the splash image with a xib; the xib is generated in Xcode 4.2 so it has a 320 480 framed view and an image view added to it with an image. Now i want all this to be working in iPhone 5 also. For that i changed the image size to 640*1136 which is added to that image view than the used one of 640*960.And i added

if([[UIScreen mainScreen] bounds].size.height == 480)
    {
        [self.view setFrame:CGRectMake(0,0,320,480 )];
    }

    else 
    {
        [self.view setFrame:CGRectMake(0,0,320,568)];
        backgroundimage.image=[UIImage imageNamed:@"[email protected]"];

        }

not working. Which has giving me some blank space in the bottom after the image. I also tried autoresizing mask. That also didn't work.

enter image description here

Can anybody get me out of this dig?

Upvotes: 1

Views: 464

Answers (2)

Edwin Iskandar
Edwin Iskandar

Reputation: 4119

Looking at your code there are 2 things I would check: - make sure backgroundImage is hooked up properly to the nib. - remove the @2x keyword to the image you are retrieving [UIImage imageNamed:@"Default-568h"]. The @2x will be appended for you to get the right file.

Other than that what you have should work granted you have a valid launch 4 inch launch image ([email protected]).

Upvotes: 2

Simon
Simon

Reputation: 25993

I'm guessing that backgroundImage is a UIImageView which is a subview of your controller's view, set in the xib to be the full size of the view. When your app runs on an iPhone 5, it will automatically set the size of the view for you, but it won't resize the subviews unless you set an autoresizing mask. See my answer to this question for how to do that.

Upvotes: 1

Related Questions