Draw segments from a circle or donut
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been trying to figure out a way to draw segments as illustrated in the following image: I'd like to: draw the segment include gradients include shadows animate the drawing from 0 to n angle I've been attempting to do this with CGContextAddArc and similar calls but not getting very far. Can anyone help ? 回答1: There are many parts to your question. Getting the path Creating the path for such a segment shouldn't be too hard. There are two arcs and two straight lines. I've previously explained how you can break down a path like that so I