欢迎光临
我们一直在努力

根据UIBezierPath和CAShapeLayer自定义倒计时进度条

建站超值云服务器,限时71元/月

根据UIBezierPath和CAShapeLayer自定义倒计时进度条

项目介绍:

WSDrawCircleProgress  https://github.com/amber01/WSDrawCircleProgress

Overview

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


公共方法
[Actionscript3] 查看源文件 复制代码

公共方法

//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;

使用
[Objective-C] 查看源文件 复制代码

- (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];
}

DEMO 直接下载:

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 根据UIBezierPath和CAShapeLayer自定义倒计时进度条
分享到: 更多 (0)