欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS启动页倒计时跳过按钮功能

程序员文章站 2023-12-21 12:40:28
wsdrawcircleprogress, 根据uibezierpath和cashapelayer自定义倒计时进度条,适用于app启动的时候设置一个倒计时关闭启动页面。可以...

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

iOS启动页倒计时跳过按钮功能

公共方法:

//set track color 
@property (nonatomic,strong)uicolor *trackcolor; 
//set progress color 
@property (nonatomic,strong)uicolor *progresscolor; 
//set track background color 
@property (nonatomic,strong)uicolor *fillcolor; 
//set progress line width 
@property (nonatomic,assign)cgfloat linewidth; 
//set progress duration 
@property (nonatomic,assign)cgfloat animationduration; 
/** 
 * set complete callback 
 * 
 * @param linewidth line width 
 * @param block  block 
 * @param duration time 
 */ 
- (void)startanimationduration:(cgfloat)duration withblock:(drawcircleprogressblock )block; 

使用:

- (void)viewdidload { 
 [super viewdidload]; 
 [self.view addsubview:self.imageview]; 
 drawcircleprogressbutton *drawcircleview = [[drawcircleprogressbutton alloc]initwithframe:cgrectmake(self.view.frame.size.width - 55, 30, 40, 40)]; 
 drawcircleview.linewidth = 2; 
 [drawcircleview settitle:@"跳过" forstate:uicontrolstatenormal]; 
 [drawcircleview settitlecolor:[uicolor whitecolor] forstate:uicontrolstatenormal]; 
 drawcircleview.titlelabel.font = [uifont systemfontofsize:14]; 
 [drawcircleview addtarget:self action:@selector(removeprogress) forcontrolevents:uicontroleventtouchupinside]; 
 /** 
  * progress 完成时候的回调 
  */ 
 __weak viewcontroller *weakself = self; 
 [drawcircleview startanimationduration:5 withblock:^{ 
  [weakself removeprogress]; 
 }]; 
 [self.view addsubview:drawcircleview]; 
} 

上一篇:

下一篇: