【发布时间】:2017-07-02 13:37:36
【问题描述】:
我正在使用UIBezierPath 来绘制曲线。曲线有效,但是我无法弯曲线条的边缘。
如果您查看曲线的顶部/底部,您会看到边缘变平,这不是我想要的。有没有办法弯曲边缘?
我正在使用一个简单的UIBezierPath 来绘制一个(几乎)半圆。这将创建我想要的曲线形状:
CAShapeLayer *circle = [CAShapeLayer layer];
circle.path = [UIBezierPath bezierPathWithArcCenter:CGPointMake(0, 0) radius:70 startAngle:1.0472 endAngle:5.23599 clockwise:NO].CGPath;
circle.fillColor = [UIColor clearColor].CGColor;
circle.strokeColor = [UIColor colorWithWhite:1.0 alpha:0.2].CGColor;
circle.lineWidth = 18.0;
circle.cornerRadius = 10.0;
circle.position = CGPointMake(100, 100);
circle.anchorPoint = CGPointMake(0.5, 0.5);
[mainView.layer addSublayer:circle];
尽管设置了cornerRadius 属性,但角不是弯曲的。我做错了什么?
感谢您抽出宝贵时间,丹。
【问题讨论】:
标签: ios objective-c uibezierpath rounded-corners cashapelayer