I am trying to migrate my app for iphone 5. I have already seen the other questions in stackoverflow and still facing the some problems in correctly showing it.
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568) {
// code for 4-inch screen
_backgroundimageView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0,320,500)];
[_backgroundimageView setImage:[UIImage imageNamed:@"image1-568h@2x.png"]];
} else {
// code for 3.5-inch screen
[_backgroundimageView setImage:[UIImage imageNamed:@"image1.png"]];
}
The size I have set for backgroundimageView is 320 x370 in the size inspector and the image size of image1-568h@2x.png has a size of 640x 1136 and of image1.png is 640×733.So, for 3.5 inch screen, it should show normally and for 4-inch screen, it should resize accordingly.
But the problem is that for 4-inch screen, it doesn’t resize and ends up showing me the same as 3inch screen with some white border to cover the remaining area.
Need some guidance to solve it. Thanks.. Can point out the mistake i am doing…
Why you are again allocating
backgroundimageViewfor iPhone 5 resolutions. Just use the same IBOutlet ofbackgroundimageViewand modify the frame and image of it.