Pregunta

I'm trying to find an efficient way to perform the following clipping operation on a CAShapeLayer that I have.

What I'm Trying to Do

I have a CAShapeLayer whose circular path consists of a UIBezierPath that has been constructed using the method [UIBezierPath bezierPathWithArcCenter:] (this is a full circle from 0 to 2PI radians), and inside of that circle, I want to cut out multiple lines that are drawn at different angles, making the area below the cut out lines transparent on the circle. I want these lines to begin and end at points on the outside of the circle aka the edges of the CAShapeLayer's path.

I'm wondering whether there is a way to use the mask property on the CAShapeLayer to accomplish this, or whether I should abandon the idea of cutting out from the full circle and just draw each arced triangle separately as different CAShapeLayers.

Thank you for your any help!

¿Fue útil?

Solución

I ended up solving this by forgetting about using masks. Instead, I just constructed a UIBezierPath using the moveToPoint: and addLineToPoint: methods in order to draw the desired portions of the circle.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top