在应用程序启动时通过splitviewcontroller呈现模态视图控制器

由于需要将UISplitViewController设置为rootviewcontroller,因此我试图在应用程序启动时以模态方式呈现viewcontroller,以充当用户的login/欢迎屏幕。 显然,我的AppDelegate.m中的下面的代码应该做的IOS 6的技巧:

#import "AppDelegate.h" #import "WelcomeViewController.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. WelcomeViewController *modalWelcomeView = [[WelcomeViewController alloc] initWithNibName:@"Welcome" bundle:nil]; [modalWelcomeView setModalPresentationStyle:UIModalPresentationFullScreen]; [self.splitViewController presentViewController:modalWelcomeView animated:NO Completion:nil]; return YES; } 

但是我得到一个“物业'splitViewController'找不到types'AppDelegate'的对象上面的行return YES; 。 我担心我在做一些愚蠢的事情

有什么build议么? 非常感谢。

唉,我发现解决scheme,实际上需要在AppDelegate.m略有不同的方法

 #import "AppDelegate.h" #import "WelcomeViewController.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; WelcomeViewController *modalWelcomeView = [storyboard instantiateViewControllerWithIdentifier:@"Welcome"]; [self.window makeKeyAndVisible]; [self.window.rootViewController presentViewController:modalWelcomeView animated:NO completion:NULL]; return YES;