当我在 UIView 上快速绘制 bezierPath 时。我得到了直线。我只需要曲线是否可以删除直线。
我可以删除灰色填充: line.fillColor = UIColor.clear.cgColor
不知道如何去除直线
代码:
let line = CAShapeLayer()
let linePath = UIBezierPath()
linePath.move(to: start)
linePath.addLine(to: end)
var dis = (end.x - start.x)/3.0
linePath.addCurve(to: start,
controlPoint1: CGPoint(x: start.x + dis, y: start.y + dis),
controlPoint2: CGPoint(x: end.x - dis, y: end.y - dis))
line.path = linePath.cgPath
line.strokeColor = UIColor.red.cgColor
//line.fillColor = UIColor.clear.cgColor
line.lineWidth = 4.0
line.opacity = 0.6
self.view.layer.addSublayer(line)
Run Code Online (Sandbox Code Playgroud)