iOS绘制Stroked Arc

时间:2014-10-05 14:02:48

标签: ios objective-c quartz-core

我试图绘制填充和描边的弧线。请看这个图像(左:我有什么。右:我需要的是什么): Left: what i have. Right: what i need

我不知道如何设置弧线连接行为。这是代码(arrowLayer是一个CAShapeLayer):

UIBezierPath *arcPath = [UIBezierPath bezierPath];


[arcPath addArcWithCenter:CGPointMake(frame.size.width/2, frame.size.height/2)
                   radius:65
               startAngle:DEGREES_TO_RADIANS(-10)
                 endAngle:DEGREES_TO_RADIANS(320)
                clockwise:YES];

[arcPath addArcWithCenter:CGPointMake(frame.size.width/2, frame.size.height/2)
                   radius:55
               startAngle:DEGREES_TO_RADIANS(-10)
                 endAngle:DEGREES_TO_RADIANS(320)
                clockwise:YES];

arrowLayer.path = [arcPath CGPath];
arrowLayer.fillColor   = [UIColor clearColor].CGColor;
arrowLayer.strokeColor = [[UIColor redColor] CGColor];
arrowLayer.lineWidth   = 1.0;

其他问题:

如何获得弧的起点和终点坐标,是否可能?它需要完成我任务的第二部分。

0 个答案:

没有答案