zoukankan      html  css  js  c++  java
  • iOS App中添加半透明新手指引

    /**
     *  新手指引
     */
    - (void)newUserGuide{
        // 这里创建指引在这个视图在window上
        CGRect frame = [UIScreen mainScreen].bounds;
        UIView * bgView = [[UIView alloc] initWithFrame:frame];
        
        UIColor *color = [UIColor blackColor];
        bgView.backgroundColor = [color colorWithAlphaComponent:0.1];
        
        UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(sureTapClick:)];
        [bgView addGestureRecognizer:tap];
        [[UIApplication sharedApplication].keyWindow addSubview:bgView];
        
        //create path 重点来了(**这里需要添加第一个路径)
        UIBezierPath *path = [UIBezierPath bezierPathWithRect:frame];
        // 这里添加第二个路径 (这个是圆)
        [path appendPath:[UIBezierPath bezierPathWithArcCenter:CGPointMake(frame.size.width - 30, 42) radius:30 startAngle:0 endAngle:2*M_PI clockwise:NO]];
        // 这里添加第二个路径 (这个是矩形)
    //    [path appendPath:[[UIBezierPath bezierPathWithRoundedRect:CGRectMake(frame.size.width/2.0-1, 234, frame.size.width/2.0+1, 55) cornerRadius:5] bezierPathByReversingPath]];
        
        CAShapeLayer *shapeLayer = [CAShapeLayer layer];
        shapeLayer.path = path.CGPath;
    //    shapeLayer.strokeColor = [UIColor blueColor].CGColor;
        [bgView.layer setMask:shapeLayer];
        UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width -300,72,270, 137)];
        //imageView.image = [UIImage imageNamed:@"CouponBoard_guid"];
        imageView.backgroundColor = [UIColor redColor];
        [bgView addSubview:imageView];
    }
    /**
     *   新手指引确定
     */
    - (void)sureTapClick:(UITapGestureRecognizer *)tap
    {
        UIView * view = tap.view;
        [view removeFromSuperview];
        [view removeGestureRecognizer:tap];
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstCouponBoard_iPhone"];
    }

    来自:http://www.jianshu.com/p/00d4fe5a3c1a

  • 相关阅读:
    Nginx 的编译安装和URL地址重写
    How to use DBVisualizer to connect to Hbase using Apache Phoenix
    Apache Phoenix on CDH 5
    Phoenix 映射 HBase + Maven
    Cloudera Manager5及CDH5在线(cloudera-manager-installer.bin)安装详细文档
    Cloudera Manager5安装总结遇到问题及解决办法 CDH 5.8 on CentOS 7
    Hive、Spark SQL、Impala比较
    OLTP与OLAP的介绍
    Using Apache Spark and MySQL for Data Analysis
    Hadoop、Hive、Spark 之间关系
  • 原文地址:https://www.cnblogs.com/qiyiyifan/p/7418610.html
Copyright © 2011-2022 走看看