我只想在第一次打開應用程序時顯示屏幕教程。 但問題是,當我第一次導航到我的應用程序,並返回到rootviewcontroller所有時間顯示教程屏幕。我想顯示「菜單」屏幕。第一次打開應用程序將所有時間都變成教程屏幕
我怎麼能設置RootViewController我的MenuViewController後教程屏幕?
謝謝!
我有這樣的代碼在appdelegate.m:在其他條件
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
if ([[[NSUserDefaults standardUserDefaults] valueForKey:@"ISFIRSTTIME"] isEqualToString:@"NO"]) {
controller = [[MenuViewController alloc] initWithNibName:@"MenuViewController" bundle:nil];
}
else {
controller = [[TutorialViewController alloc] initWithNibName:@"TutorialViewController" bundle:nil];
}
_navController = [[UINavigationController alloc] initWithRootViewController:controller];
[self.window setRootViewController:_navController];
[self.window makeKeyAndVisible];
'NSUserDefaults'有'setBool:forKey:'和'boolForKey:'你可以用它代替比較字符串的方法' @「NO」' – EmilioPelaez