• iOS 添加功能引导图


    iOS 添加功能引导图

     
    首次安装app之后,打开app首页,有一张功能引导图,其实最简单的一种做法是,直接在这个首页上加一个蒙层图片。
    
    在蒙层上用气泡显示文字注明功能介绍,这个蒙层图片,让你们的UI设计师给你。

    然后在进入首页的viewDidAppear方法里,添加上你的蒙层

    [self initIntroduceView];

    下面是添加的简单示例代码:

    示例

    - (void)initIntroduceView
    
    {
    
    if (![USERDEFAULT objectForKey:@"IsShowIntro"]) {
    
    UIImageView *introImg = [[UIImageView alloc] initWithFrame:self.view.bounds];
    
    introImg.tag = INTRO_TAG;
    
    introImg.userInteractionEnabled = YES;
    
    if (iPhone4S) {
    
    introImg.image = [UIImage imageNamed:@"explanation_960"];
    
    }
    
    else
    
    {
    
    introImg.image = [UIImage imageNamed:@"explanation"];
    
    }
    
    [self.tabBarController.view addSubview:introImg];
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeIntroImg)];
    
    tap.numberOfTapsRequired = 1;
    
    [introImg addGestureRecognizer:tap];
    
    }
    
    }
    
    - (void)removeIntroImg
    
    {
    
    [USERDEFAULT setObject:[NSNumber numberWithBool:YES] forKey:@"IsShowIntro"];
    
    UIImageView *imgView = (UIImageView *)[self.tabBarController.view viewWithTag:INTRO_TAG];
    
    [imgView removeFromSuperview];
    
    }
    
    关于几个宏
    
    #define USERDEFAULT [NSUserDefaults standardUserDefaults]
    
    #define iPhone4S ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
    
    #define INTRO_TAG 50000
  • 相关阅读:
    Nginx 静态资源缓存设置
    Ubuntu Linux 与 Windows 7双系统安装教程(图文)
    配置可以通过http协议访问的svn服务器
    CentOS下搭建SVN服务器
    LINUX服务器下用root登录ftp
    CentOS 6下编译安装MySQL 5.6
    Jenkins代码管理
    python学习:备份文档并压缩为zip格式
    centos 7 双网卡建网桥脚本实现
    python学习:使用正则收集ip信息
  • 原文地址:https://www.cnblogs.com/LiLihongqiang/p/7423284.html
Copyright © 2020-2023  润新知