我想创建如下图所示的内容 我如何用Swhed Core Graphics和虚线创建它 我也想以圆形形式创造这种气罐表盘或车速表。
我目前的代码在
之下 let dashes: [CGFloat] = [2, 2]
let dashedLine = UIBezierPath()
dashedLine.move(to: CGPoint(x: 0, y: rect.height/2))
dashedLine.addLine(to: CGPoint(x: rect.width, y: rect.height/2))
dashedLine.setLineDash(dashes, count: dashes.count, phase: 0)
dashedLine.lineWidth = 5
UIColor.black.setStroke()
dashedLine.stroke()