iOS启动页倒计时跳过按钮

WSDrawCircleProgress, 根据UIBezierPath和CAShapeLayer自定义倒计时进度条,适用于app启动的时候设置一个倒计时关闭启动页面。可以设置进度条颜色,填充颜色,进度条宽度以及点击事件等。

iOS启动页倒计时跳过按钮


公共方法:

[objc] view plain copy
  1. //set track color  
  2. @property (nonatomic,strong)UIColor    *trackColor;  
  3.   
  4. //set progress color  
  5. @property (nonatomic,strong)UIColor    *progressColor;  
  6.   
  7. //set track background color  
  8. @property (nonatomic,strong)UIColor    *fillColor;  
  9.   
  10. //set progress line width  
  11. @property (nonatomic,assign)CGFloat    lineWidth;  
  12.   
  13. //set progress duration  
  14. @property (nonatomic,assign)CGFloat    animationDuration;  
  15.   
  16. /** 
  17.  *  set complete callback 
  18.  * 
  19.  *  @param lineWidth line width 
  20.  *  @param block     block 
  21.  *  @param duration  time 
  22.  */  
  23. - (void)startAnimationDuration:(CGFloat)duration withBlock:(DrawCircleProgressBlock )block;  


使用:

[objc] view plain copy
  1. - (void)viewDidLoad {  
  2.     [super viewDidLoad];  
  3.     [self.view addSubview:self.imageView];  
  4.   
  5.     DrawCircleProgressButton *drawCircleView = [[DrawCircleProgressButton alloc]initWithFrame:CGRectMake(self.view.frame.size.width - 55304040)];  
  6.     drawCircleView.lineWidth = 2;  
  7.     [drawCircleView setTitle:@"跳过" forState:UIControlStateNormal];  
  8.     [drawCircleView setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];  
  9.     drawCircleView.titleLabel.font = [UIFont systemFontOfSize:14];  
  10.   
  11.     [drawCircleView addTarget:self action:@selector(removeProgress) forControlEvents:UIControlEventTouchUpInside];  
  12.   
  13.     /** 
  14.      *  progress 完成时候的回调 
  15.      */  
  16.     __weak ViewController *weakSelf = self;  
  17.     [drawCircleView startAnimationDuration:5 withBlock:^{  
  18.         [weakSelf removeProgress];  
  19.     }];  
  20.   
  21.     [self.view addSubview:drawCircleView];  
  22. }