如果应用程序已打开一次,我正在尝试更改Root View控制器。这是我正在做的事情。布尔是完全正常的,我知道因为它打印'欢迎回来'。这就是我想要做的事情。
- (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;
}
答案 0 :(得分:0)
好像你没有正确设置/更新应用程序窗口。我创建了一个可能有帮助的示例项目。 https://github.com/deepthit/UpdateRootViewController.git