如何在圆形进度条上添加多个圆圈?

时间:2020-03-26 16:44:56

标签: ios objective-c cocos2d-iphone swift4.2

我已经实施了循环进度条。但现在我想在进度条上添加多个圆圈。如下图所示

enter image description here

我已经实现了以下代码

let rect = rectForShape()
let circlePath = UIBezierPath(arcCenter: CGPoint(x:rect.midX , y: rect.midY), radius: CGFloat(10), startAngle: CGFloat(50), endAngle: CGFloat(Double.pi * 2), clockwise: true)

let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.cgPath
// Change the fill color
shapeLayer.fillColor = UIColor.clear.cgColor
// You can change the stroke color
shapeLayer.strokeColor = UIColor.red.cgColor
// You can change the line width
shapeLayer.lineWidth = 3.0
view.layer.addSublayer(shapeLayer)

0 个答案:

没有答案