【发布时间】:2021-01-19 21:44:31
【问题描述】:
这是我将椭圆 CALayer 添加到 UIView 的代码:
let circleLayer = CAShapeLayer()
circleLayer.path = UIBezierPath(arcCenter: CGPoint(x: frame.size.width / 2, y: frame.size.height / 2),
radius: frame.size.width / 2,
startAngle: -.pi / 2,
endAngle: .pi / 6,
clockwise: false).cgPath
circleLayer.lineWidth = 8.0
circleLayer.cornerRadius = 4.0
circleLayer.strokeColor = UIColor.black.cgColor
circleLayer.fillColor = UIColor.clear.cgColor
circleLayer.lineJoin = .round
squareView.layer.backgroundColor = UIColor.clear.cgColor
squareView.layer.addSublayer(circleLayer)
我得到的结果:
但是,我想得到这个结果:
你能帮我弄到这个吗?
感谢您的帮助!
【问题讨论】: