我在一本书中发现,为了展示家谱(家谱)树,最好使用带有拓扑排序的 DAG(有向无环图),但该算法取决于输入数据的顺序。
添加我的代码。它用另一个 alpha 添加了一个边框,如阴影。
let sliderLayer = CAShapeLayer()
sliderLayer.fillColor = UIColor.white.cgColor
sliderLayer.strokeColor = UIColor.red.withAlphaComponent(0.5).cgColor
sliderLayer.lineWidth = 20
sliderLayer.miterLimit = 0.0
sliderLayer.lineCap = kCALineCapRound
sliderLayer.lineJoin = kCALineJoinRound
let bezierPath = UIBezierPath()
bezierPath.addArc(withCenter: CGPoint(x:bounds.midX, y:bounds.midY), radius: 190 / 2, startAngle: 0, endAngle: CGFloat(Double.pi * 2), clockwise: true)
sliderLayer.path = bezierPath.cgPath
Run Code Online (Sandbox Code Playgroud)