0

I am trying to change the Root View controller if the application has been opened once. Here is what im doing. The boolean is fully functional and i know because it prints 'Welcome Back'. Here is what im trying to do.

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.

    if ([[NSUserDefaults standardUserDefaults] boolForKey:@"HasLaunchedOnce"])
    {
        // App Already launched
        RootMenuController *viewController = [[RootMenuController alloc] init];
        [UIApplication sharedApplication].keyWindow.rootViewController = viewController;
    }
    else
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"HasLaunchedOnce"];
        [[NSUserDefaults standardUserDefaults] synchronize];
        // This is the first launch ever

    }

        [self.window makeKeyAndVisible];

    return YES;
}
4

1 回答 1

0

您似乎没有正确设置/更新应用程序窗口。我创建了一个可能有帮助的示例项目。https://github.com/deepthit/UpdateRootViewController.git

于 2013-10-21T00:38:32.323 回答