我无法在使用UIBezierPath创建的弧线上显示圆角。无论是否设置kCGLineCapRound,它都仍然是完全方形的。
这个问题应该与这个主题相同,但解决方案不起作用。
下面是我在viewWillAppear中为测试目的而编写的示例代码:
int radius = 100;
CAShapeLayer *arc = [CAShapeLayer layer];
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(100, 50) radius:radius startAngle:M_PI endAngle:M_PI/150 clockwise:YES];
path.lineCapStyle = kCGLineCapRound;
arc.path = path.CGPath;
arc.position = CGPointMake(CGRectGetMidX(self.view.frame)-radius, CGRectGetMidY(self.view.frame)-radius);
arc.fillColor = [UIColor clearColor].CGColor;
arc.strokeColor = [UIColor purpleColor].CGColor;
arc.lineWidth = 10.0f;
arc.cornerRadius = 3.0f;
这是它的外观:
我很无助,所以我会感激任何帮助。谢谢大家。