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

时间:2022-10-16 09:03:19

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

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

公共方法:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//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;

使用:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
- (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];
}

 

原文链接:http://blog.csdn.net/wanglei0918/article/details/74269729