UIBezierPath - 添加圆角
问题描述:
我正在使用UIBezierPath
绘制曲线。但曲线起作用,我无法曲线的边缘。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
财产,边角都没有弯曲。我究竟做错了什么?
谢谢你的时间,丹。
答
包括以下内容。
circle.lineCap = kCALineJoinRound;
对于雨燕3.0
circle.lineCapStyle = .Round;
答
雨燕4.0
circle.lineCap = kCALineCapRound
,如果你也想被你的圆润线条交叉设置
circle.lineJoin = kCALineCapRound
。
完美的作品,谢谢! – Supertecnoboff