我使用以下代码绘制饼图的一部分:
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的副作用,我内心也有一点圈子。我需要摆脱它,你能帮助我吗?
答案 0 :(得分:0)
解决了,问题是由于在layoutSubviews中添加了两次CAShapeLayer导致了这种奇怪的效果。