CAShapeLayer 在中心绘制一个圆作为线帽设置为 kCAL lineJoin Round 的副作用

CAShapeLayer draws a circle in center as a sideeffect of line cap set to kCALineJoinRound

我正在使用以下代码绘制饼图的一部分:

CAShapeLayer *segment = [CAShapeLayer layer];
UIBezierPath *segmentPath = [UIBezierPath bezierPath];

[segmentPath addArcWithCenter:segmentCenter radius:segmentRadius startAngle:angle1 endAngle:angle2 clockwise:YES];

segment.path = [segmentPath CGPath];
[segment setLineCap:kCALineJoinRound]; // this is the line which causes this

segment.lineWidth = 8;
segment.fillColor = [[UIColor clearColor] CGColor];
segment.strokeColor = [[UIColor orangeColor] CGColor];

[self.layer addSublayer:segment];

作为设置 kCALineJoinRound 的副作用,我在里面也得到了一个小圆圈。我需要摆脱它,你能帮我吗?

已解决,问题是在layoutSubviews中添加了两次CAShapeLayer导致出现这种奇怪的效果