Question

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.

Was it helpful?

Solution

Alas I found the solution, actually required a slightly different approach in 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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top