CAShapeLayer 为一条路径绘制不同的线宽,Swift

CAShapeLayer draws different line width for one path, Swift

我在绘制曲线时遇到问题:

strokePath = UIBezierPath()
strokePath.move(to: CGPoint(x:curveWidth / 2.0 -  headerWidth, y: headerHeight))
strokePath.addLine(to: CGPoint(x: 0, y: headerHeight))
strokePath.addCurve(to: CGPoint(x: curveRadius, y: headerHeight - curveRadius),
                    controlPoint1: CGPoint(x: degree, y: headerHeight),
                    controlPoint2: CGPoint(x: curveRadius, y: headerHeight - curveRadius))
strokePath.addLine(to: CGPoint(x: curveWidth - curveRadius, y: curveRadius))
strokePath.addCurve(to: CGPoint(x: curveWidth, y: 0),
                    controlPoint1: CGPoint(x: curveWidth - curveRadius + curveRadius * 0.25, y: 0),
                    controlPoint2: CGPoint(x: curveWidth, y: 0))
strokePath.addLine(to: CGPoint(x: self.frame.size.width, y: 0.0))

strokeLayer.path = strokePath.cgPath
strokeLayer.strokeColor = uiConfig.color.misc.tabGrayBorder.cgColor
strokeLayer.fillColor = UIColor.clear.cgColor
strokeLayer.lineWidth = 0.5
self.layer.addSublayer(strokeLayer)

我有意想不到的结果:

曲线比直线粗,有人知道它为什么会发生以及它是如何修复的吗?

抱歉,这是我的错误,在查看多行代码后,我发现我的一个父视图 "Clip to bounds" 属性 处于活动状态