0
我有3个UIBezierPath,有2个圆圈,一行从1个圆圈的中心到另一个,它看起来像是底部的图片。我想隐藏像顶部图片一样的圆圈内部分。有没有简单的方法来做到这一点?隐藏UIBezierPath的一部分
我的策略是从中心画出一条看不见的线,然后从两个圆的圆周画一条黑线,因为我知道斜坡等,但看起来工作太多了。
private func pathForBoxCircle1() -> UIBezierPath {
let circlePath = UIBezierPath(arcCenter:circle1BoxCurrentCenter, radius: 25, startAngle: 0.0, endAngle: CGFloat(2*M_PI), clockwise: false)
//circlePath.fill()
pathBoxCircle1Global = circlePath
return circlePath
}
private func pathForBoxCircle2() -> UIBezierPath {
let circlePath = UIBezierPath(arcCenter:circle2BoxCurrentCenter, radius: 25, startAngle: 0.0, endAngle: CGFloat(2*M_PI), clockwise: false)
//circlePath.fill()
pathBoxCircle2Global = circlePath
return circlePath
}
private func pathForHorizonLine() -> UIBezierPath {
let path = UIBezierPath()
path.move(to: circle1BoxCurrentCenter)
path.addLine(to: circle2BoxCurrentCenter)
path.lineWidth = 5.0
//pathHorizonLineGlobal = path
return path
}
override func draw(_ rect: CGRect) {
pathForBoxCircle1().stroke()
pathForBoxCircle2().stroke() // same as stroke()
pathForHorizonLine().stroke()
}
填充圆圈的颜色? – HMHero
@HHHero我想圈出来看看 – bakalolo
你可以显示你的代码来绘制路径吗?你能不能从圆圈的最右边画线到另一个圆圈的最左边部分? – Ali