I have this piece of code:
let arcPath = UIBezierPath(ovalInRect: CGRectMake(0, 0, frame.width, frame.height))
circleLayer = CAShapeLayer()
circleLayer.path = arcPath.CGPath
circleLayer.fillColor = UIColor.clearColor().CGColor
circleLayer.strokeColor = UIColor.blueColor().CGColor
circleLayer.lineWidth = 5.0;
circleLayer.strokeStart = 0
circleLayer.strokeEnd = 0.7
which results like this:
As you can see, the arc starts on the right side of the circle. I would like to draw the arc starting from the top. How would I do that? Do I have to rotate the whole thing by -90 degrees to accomplish what I'm trying to do?
Thanks.
You can create the path like this
let bezierPath = UIBezierPath(arcCenter:CGPointMake(100,100), radius:40, startAngle: CGFloat(M_PI_2) * 3.0, endAngle:CGFloat(M_PI_2) * 3.0 + CGFloat(M_PI) * 2.0, clockwise: true)
SceenShot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With