zoukankan      html  css  js  c++  java
  • 本地持久化存储

    //用持久化对象去存储一个字符串作为标识,如果找到标识用户不是第一次登陆,就加在主界面,如果找不到,说明用户是第一次登陆,加载引导界面.

        if (![[NSUserDefaults standardUserDefaults] boolForKey:@"ccc"]) {

            UserGuideViewController *guideVC = [[UserGuideViewController alloc] init];

            self.window.rootViewController = guideVC;

            [guideVC release];

        }else{

            RootViewController *rootVC= [[RootViewController alloc] init];

            self.window.rootViewController = rootVC;

            [rootVC release];

        }

    在userGuide最后一页加一个tap手势,给手势添加一个轻拍事件

    - (void)handleTap:(UITapGestureRecognizer *)tap{

        //1.将字符串持久化存储

        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"ccc"];

        //立刻同步(立刻存储)

        [[NSUserDefaults standardUserDefaults] synchronize];

        //2.进入主页面

        RootViewController *rootVC = [[RootViewController alloc] init];

        [UIApplication sharedApplication].keyWindow.rootViewController = rootVC;

        [rootVC release];

    }

  • 相关阅读:
    P5047 [Ynoi2019 模拟赛] Yuno loves sqrt technology II
    P4887 【模板】莫队二次离线(第十四分块(前体))
    SP20644 ZQUERY
    企业战略管理【0612】
    管理经济学【0812】
    商务沟通[0664]
    国际企业管理【0813】
    社区管理【0272】
    战略管理【1059】
    管理沟通【1279】
  • 原文地址:https://www.cnblogs.com/lion-witcher/p/5167396.html
Copyright © 2011-2022 走看看