Search code examples
iosretina-displayiphone-5

can't display 640x1136 image on iphone5


I've added a [email protected] launch image to my app. The app needs to display a second launch image after the "real" launch image. Because the UIImage imageNamed: method doesn't automatically load the taller image the way it automatically loads retina images, I've added some code to detect the screen size and display the correct image:

-(void)pickRightImage
{
    CGSize result = [[UIScreen mainScreen] bounds].size;
    UIImageView *imgv = [self loadingImage];

    UIImage *img;

    if(result.height == 480)
    {
        img = [UIImage imageNamed:@"loading_screen.png"];
    } else if([UIScreen mainScreen].scale == 2.f && result.height == 568) {
        // iPhone 5
       img = [UIImage imageNamed:@"[email protected]"];       
    }
    [imgv setImage:img];
}

The imageView takes up the whole screen in the NIB, which is named MainWindow, and I have selected the checkbox named "Full Screen At Launch" However, the image never takes up the whole screen. (Although the launch image does.) The second image is letter boxed just as if it were a smaller image, and I had never included the tall launch image.

Is there anyway to programmatically display a full screen image on the 4 inch iphone5? Why is my image always resized?


Solution

  • I tested this on the main view controller. Also, on Target > Summary > Status Bar > Visibility check "Hide during application launch".

    - (void)viewDidLoad
    {
        [super viewDidLoad];
        UIImageView *iv = [[UIImageView alloc] initWithFrame:self.view.bounds];
        iv.image = [UIImage imageNamed:@"[email protected]"];
        [self.view addSubview:iv];
    }