Reputation: 1331
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.
Upvotes: 7
Views: 5024
Reputation: 385890
You need to set the lineDashPattern
property of circle
. For example:
circle.lineDashPattern = @[@2, @3];
Upvotes: 9