CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius:radius].CGPath;
// Configure the apperence of the circle
circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = [UIColor whiteColor].CGColor;
circle.lineWidth = 1;
// Add to parent layer
[[background layer] addSublayer:circle];
I have drawn a circle and added it as a sublayer. What I don't understand is how to make the circle line dashed? I have added my circle code above.
You need to set the lineDashPattern
property of circle
. For example:
circle.lineDashPattern = @[@2, @3];
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