1

Due to the need for UISplitViewController to be rootviewcontroller, I am trying instead to present a viewcontroller modally at app startup to act as a login/welcome screen for the user. Apparently the following code in my AppDelegate.m should do the trick with 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;
}

yet I get a "Property 'splitViewController' not found on object of type 'AppDelegate'" for the line above return YES;. I fear I'm doing something silly...

Any suggestions? Many thanks.

4

1 回答 1

4

唉,我找到了解决方案,实际上需要一种稍微不同的方法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;
于 2013-09-17T11:29:37.927 回答