IOS - Set Dashed Line for Circle

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 drew a circle and added it as a sublevel. I don’t understand how to make the circular line dashed? I added the circle code above.

+4
source share
1 answer

You need to set the lineDashPattern circle property . For instance:

 circle.lineDashPattern = @[@2, @3]; 
+5
source

Source: https://habr.com/ru/post/1440857/


All Articles