【发布时间】:2016-11-16 21:03:39
【问题描述】:
目前正在制作圆形图表,绘制完整的圆形没有问题。我还需要画一个 3/4 圆,是否有任何指定数学来定义 3/4 圆路径。我尝试用整圈减少错过的位置值,但无法获得准确的结果。有人可以帮忙吗?如果有需要我
UIBezierPath *circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.frame.size.width/2.0f, self.frame.size.height/2.0f)
radius:(self.frame.size.height * 0.5) - ([_lineWidth floatValue]/2.0f)
startAngle:DEGREES_TO_RADIANS(startAngle)
endAngle:DEGREES_TO_RADIANS(endAngle)
clockwise:clockwise];
circle = [CAShapeLayer layer];
circle.path = circlePath.CGPath;
circle.lineCap = kCALineCapRound;
circle.fillColor = [UIColor clearColor].CGColor;
circle.lineWidth = [_lineWidth floatValue];
circle.zPosition = 1; [self.layer addSublayer:circle];
;
请参考下图,
注意:我附上了来自网络的示例图片,但我确信我需要相同的结果。
【问题讨论】:
标签: ios objective-c calayer uibezierpath cashapelayer