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
條件。
但我創建的其他應用程序正常工作。
這是什麼原因?