Ios5 有条件地从AppDelegate加载情节提要文件和第一个场景

Ios5 有条件地从AppDelegate加载情节提要文件和第一个场景,ios5,xcode4.5,uistoryboard,appdelegate,Ios5,Xcode4.5,Uistoryboard,Appdelegate,我最近将我的应用程序转换为通用二进制文件,并将现有的故事板复制为一个为iPad格式化的故事板。我的印象是我可以有条件地从该方法加载情节提要文件 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 我在上面的方法中有以下代码,但我的初始场景不是从故事板文件加载的。我得到一个白色屏幕,里面什么也没有,但我确实看到了状态栏 // iPa

我最近将我的应用程序转换为通用二进制文件,并将现有的故事板复制为一个为iPad格式化的故事板。我的印象是我可以有条件地从该方法加载情节提要文件

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
我在上面的方法中有以下代码,但我的初始场景不是从故事板文件加载的。我得到一个白色屏幕,里面什么也没有,但我确实看到了状态栏

// iPad Legacy 1024 x 768
    if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
        // the iOS device is in the iPad family.


        NSLog(@"the iOS device = %@",[UIDevice currentDevice]);

        CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;

        NSLog(@"The size of screen is %f",iOSDeviceScreenSize.height);

            if (iOSDeviceScreenSize.height == 1024) {

                // load storyboard , load rootviewcontroller, show initial scene

                UIStoryboard *sbipad = [UIStoryboard storyboardWithName:@"iPad" bundle:nil];

                ViewControllerWelcome *vcwelcome = [sbipad instantiateInitialViewController];

                self.window.rootViewController = vcwelcome;

                [self.window makeKeyAndVisible];

                NSLog(@"iPad storyboard file loaded");
            }
    }

    if([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) {

        CGSize iOSDeviceScreenSize = [[UIScreen mainScreen] bounds].size;

            if (iOSDeviceScreenSize.height == 480) {

                // iphone 3GS, 4, 4S, and iPod Touch 3rd and 4th gen 3.5 inch screen diagnolly measured

                UIStoryboard *sbiphone = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];

                ViewControllerWelcome *vcwelcome = [sbiphone instantiateInitialViewController];

                self.window.rootViewController = vcwelcome;

                [self.window makeKeyAndVisible];

                NSLog(@"iPhone storyboard file loaded");
            }

            if (iOSDeviceScreenSize.height == 568) {

                // iphone 5 and ipod touch 5th gen: 4 inch screen diagnolly measured

                UIStoryboard *sbiphone = [UIStoryboard storyboardWithName:@"iPhone" bundle:nil];

                ViewControllerWelcome *vcwelcome = [sbiphone instantiateInitialViewController];

                self.window.rootViewController = vcwelcome;

                [self.window makeKeyAndVisible];

                NSLog(@"iPhone storyboard file loaded for iPhone 5 (4inch screen)");
            }
    }

    return YES;

如何/在何处创建UIWindow?你有没有从Info.plist中删除任何故事板引用?@valheru我检查了Info.plist,一切似乎都是它应该做的。稍后我将拍摄屏幕截图