我有一个基于百分比填充的圆圈,但我需要它有一个多颜色边框,即0-.10是橙色,。10-.50是蓝色,。50-.70是紫色,并且.70-1是黑色的。
let circlePath = UIBezierPath(arcCenter: CGPointMake(cell.progress.frame.width / 2, cell.progress.frame.height / 2), radius: CGFloat(60), startAngle: CGFloat(-M_PI_2), endAngle:CGFloat(M_PI * 2 * percentage - M_PI_2), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.CGPath
shapeLayer.fillColor = UIColor.clearColor().CGColor
shapeLayer.strokeColor = UIColor.redColor().CGColor
shapeLayer.lineWidth = 3.0
cell.progress.layer.addSublayer(shapeLayer)