gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 05:58:05 25 4
gpt4 key购买 nike

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

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)

我得到了意想不到的结果:

curve

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

最佳答案

抱歉,在检查了许多行代码后,我发现我的父 View 之一的“剪辑到边界”属性处于事件状态,这是我的错误

关于ios - CAShapeLayer 为一条路径绘制不同的线宽,Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54947983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com