首页 > 代码库 > iOS空心圆下载进度指示器控件
iOS空心圆下载进度指示器控件
self.layer = [CAShapeLayer layer]; self.layer.frame = CGRectMake(0, 0, 100, 100); self.layer.position = self.view.center; self.layer.lineWidth = 10.0; self.layer.fillColor = [UIColor clearColor].CGColor; self.layer.strokeColor = [UIColor lightGrayColor].CGColor; self.layer.lineCap = kCALineCapSquare; /* CA_EXTERN NSString *const kCALineCapButt __OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_3_0); CA_EXTERN NSString *const kCALineCapRound __OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_3_0); CA_EXTERN NSString *const kCALineCapSquare */ UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)]; self.layer.path = path.CGPath; [self.view.layer addSublayer:self.layer]; self.layer.strokeEnd = 0.0; _progress = 0; self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(updateProgress) userInfo:nil repeats:YES];//更新下载进度_progress += 0.01; if (self.layer.strokeEnd >= 1) { self.timer.fireDate = [NSDate distantFuture]; } else { self.layer.strokeEnd = _progress; }
iOS空心圆下载进度指示器控件
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。