1
我可以創建一個圈子,但我需要它在「12:00」開始並達到一定比例。如何根據百分比製作圓圈?
let circlePath = UIBezierPath(arcCenter: CGPoint(x: 100,y: 100), radius: CGFloat(20), startAngle: CGFloat(0), endAngle:CGFloat(M_PI * 2), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.CGPath
//change the fill color
shapeLayer.fillColor = UIColor.clearColor().CGColor
//you can change the stroke color
shapeLayer.strokeColor = UIColor.redColor().CGColor
//you can change the line width
shapeLayer.lineWidth = 3.0
cell.progress.layer.addSublayer(shapeLayer)
更改開始和結束角度以滿足您的需求。 – rmaddy