ios - 在 App 的整个生命周期中仅显示一次 View

标签 ios objective-c xcode

我正在开发一个购物应用程序,在应用程序启动时,它会显示注册 View ,一旦单击跳过按钮,它就会导航到主页 View 。我想在应用程序的整个生命周期中只显示一次注册 View 。

最佳答案

在此处添加我用来在整个应用程序生命周期中仅显示一次演练屏幕的代码。这可能对您有用。

   // 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

    }

关于ios - 在 App 的整个生命周期中仅显示一次 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41196947/

相关文章:

javascript - 是否可以在 iOS 的 Edge 中下载 blob 文件?

iphone - 从单个方法实例化一定数量的唯一对象

ios - 外设管理器如何理解哪个是 CBCentral(设备)试图访问服务/特征

iphone - 我什么时候使用 CFRelease?

iphone - 找不到 iOS 10 开发者磁盘镜像

ios - 如何使用 Swift 3 在 iOS 10 上隐藏状态栏及其内容?

ios - 在 Xcode 4.4 中使用不受支持的编译器

ios - 无法隐藏状态栏cocos2d iOS 7

android - Flex 4.6 隐藏/关闭软键盘

ios - swift 。无法将我的按钮连接到我类(class)中的 GIDSignIn 按钮