iOS启动页倒计时跳过按钮功能
程序员文章站
2023-12-21 12:40:28
wsdrawcircleprogress, 根据uibezierpath和cashapelayer自定义倒计时进度条,适用于app启动的时候设置一个倒计时关闭启动页面。可以...
wsdrawcircleprogress, 根据uibezierpath和cashapelayer自定义倒计时进度条,适用于app启动的时候设置一个倒计时关闭启动页面。可以设置进度条颜色,填充颜色,进度条宽度以及点击事件等。
公共方法:
//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]; }