无法在 iphone5 上显示 640x1136 图像 [英] can't display 640x1136 image on iphone5

查看:50
本文介绍了无法在 iphone5 上显示 640x1136 图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 Default-568h@2x.png 启动图像添加到我的应用中.应用程序需要在真实"启动图像之后显示 第二个 启动图像.因为 UIImage imageNamed: 方法不会像自动加载视网膜图像那样自动加载更高的图像,所以我添加了一些代码来检测屏幕尺寸并显示正确的图像:

I've added a Default-568h@2x.png 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:@"loading_screen-568h@2x.png"];       
    }
    [imgv setImage:img];
}

imageView 占据了 NIB 中的整个屏幕,名为 MainWindow,我选择了名为启动时全屏"的复选框.但是,图像永远不会占据整个屏幕.(虽然发射图像确实如此.)第二张图像是用字母加框的,就像它是一个较小的图像一样,我从来没有包含高大的发射图像.

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.

有没有办法在 4 英寸 iphone5 上以编程方式显示全屏图像?为什么我的图片总是调整大小?

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

推荐答案

我在主视图控制器上测试了这个.此外,在目标 > 摘要 > 状态栏 > 可见性上,选中在应用程序启动期间隐藏".

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:@"Second-default568h@2x.png"];
    [self.view addSubview:iv];
}

这篇关于无法在 iphone5 上显示 640x1136 图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆