无法在模拟器中检测到iPhone Retina 4英寸屏幕尺寸 [英] Unable to detect iPhone Retina 4-inch screen size in simulator

查看:274
本文介绍了无法在模拟器中检测到iPhone Retina 4英寸屏幕尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让我的iOS应用程序支持iPhone 5.所以我为iPhone 5大小创建了一个单独的xib集。然后我通过检查屏幕高度加载每个xib。

I want to make my iOS application support iPhone 5. So I created a separate xib set for iPhone 5 size. Then I load each xib by checking the screen height.

这是AppDelegate.m中的启动画面加载代码:

This is the splash screen loading code inside the AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    UIViewController *viewController1;
    if ([UIScreen mainScreen].bounds.size.height==480) {
        viewController1 = [[SplashScreen alloc] initWithNibName:@"SplashScreen" bundle:nil];
    }


    if ([UIScreen mainScreen].bounds.size.height==568) {
        viewController1 = [[SplashScreen alloc] initWithNibName:@"SplashScreen5" bundle:nil];
    }

    self.window.rootViewController = viewController1;
    [self.window makeKeyAndVisible];
    return YES;
}

但当我将模拟器更换为Retina 4英寸时,我的代码没有'获得模拟器大小。如果条件,它总是执行480

But when I change the simulator into Retina 4-inch, my code doesn't get the emulator size. It always executes the 480 if condition.

但是我创建的其他应用程序正常运行。

这是什么原因?

But other apps I created like this are working properly.
What is the reason for this?

推荐答案

我现在遇到了完全相同的问题(当然是在最糟糕的时刻......)。
它确实工作了几个星期,由于一个未知的原因,模拟器突然将4英寸模拟设备视为3.5英寸屏幕。
清理,重置,重启:同样的情况...

I'm having the exact same problem right now (at the worst moment, of course....). It did work properly for several weeks, and for a unknown reason, the simulator suddenly considers the 4in simulated device as a 3.5in screen. cleaning, reset, reboot : same situation...

编辑:好的,问题解决了。 T'是因为-568 @ 2x格式中缺少默认图像。我知道这是使系统工作的一个条件,但xcode显然决定摆脱我选择的那个。哦,好吧......

EDIT : ok, problem solved. T'was because of a missing Default image in the -568@2x format. I knew that was a condition to make the system work, but xcode had apparently decided to get rid off the one I chose. oh well...

这篇关于无法在模拟器中检测到iPhone Retina 4英寸屏幕尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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