1
我想让我的iOS应用程序支持iPhone 5.因此,我为iPhone 5尺寸创建了一个单独的xib集。然后通过检查屏幕高度来加载每个xib。无法在模拟器中检测iPhone Retina 4英寸屏幕尺寸
这是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;
}
但是,当我改变模拟器为视网膜4英寸的,我的代码没有得到仿真器的大小。它始终执行480 if
条件。
但我创建的其他应用程序正常工作。
这是什么原因?