我正在开发购物应用程序并在应用程序启动时显示注册视图,一旦单击跳过按钮,它就会导航到主视图。我想在应用程序的整个生命周期中只显示一次注册视图。
答案 0 :(得分:2)
在这里添加我用于在整个应用程序生命周期中仅显示一次漫游屏幕的代码。这对你有用。
// show walkthough for first time only (first time the app launches after download).
bool shownFlag = [[NSUserDefaults standardUserDefaults] boolForKey:@"walkthroughShownOnce"];
if(!shownFlag){
[[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"walkthroughShownOnce"];
[[NSUserDefaults standardUserDefaults] synchronize];
WalkThroughViewController *vc=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"WalkThroughViewController"];
[self.window makeKeyAndVisible];
[self.window setRootViewController:vc];
}else{
//if not walkthough go and check other task
}