zoukankan      html  css  js  c++  java
  • IOS中新手引导页面的实现(新手引导,Guide)

    1.由于项目的需要,我今天学习了新手的引导,接下我来说下新手引导的使用方法:(在程序中运行一次)接下来是实现代码:

    在AppDelegate.m 的代码:

     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

        UIViewController *root;

        BOOL answer= [[NSUserDefaults standardUserDefaults]boolForKey:@"answer"];

        if (!answer) {

            root = [[WecomeViewController1 alloc]init];  //欢迎界面的,就是介绍产品的新特性

        }

        else{

                root = [[TestViewController alloc]init];

        }

        self.window.rootViewController = root;

        [self.window makeKeyAndVisible];

        return YES;

    }

    在需要调用的的时候实现的代码为:

    -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{

         NSString *anwerLabel  = self.anwerLabel.text;

        if([anwerLabel isEqualToString:@""]){

                  [self showString:@"答案错误,不要太生气!!"];

            return;

        }

        if([anwerLabel isEqualToString:@"1234"]){

            [self showString:@"恭喜你回答正确!!"];

            TestViewController *testVC = [[TestViewController alloc]init];

            [self presentViewController:testVC animated:NO completion:nil];

           //在这里设置判断是否为第一次,然后设置同步

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

            [[NSUserDefaults standardUserDefaults]synchronize];

        }

    }

    希望可以帮助有需要的人!欢迎你们提出宝贵的意见!!

  • 相关阅读:
    Windows下Yarn安装与使用
    论文阅读Graph Convolutional Matrix Completion
    如何快速查询中科院JCR分区和汤森路透JCR分区
    Implement GAN from scratch
    PyCharm将main.py解析成text文件的解决方法
    理解PyTorch的自动微分机制
    mcast_set_if函数
    mcast_get_if函数
    mcast_unblock_source函数
    mcast_block_source函数
  • 原文地址:https://www.cnblogs.com/zhufeng1994/p/4637811.html
Copyright © 2011-2022 走看看