在中央凸起按钮后面挥动弯曲的(上部)标签栏。 İ通过使用“ https://medium.com/@philipp307/draw-a-custom-ios-tabbar-shape-27d298a7f4fa”的引用为标签栏创建了自定义类,但实际上İ需要在标签栏的中心创建“弯曲曲线”。 İ曾尝试使用Bézier曲线,但未在中央按钮后面找到确切位置。我不需要蘸一下。 İ需要在我的自定义代码和附加的图像后面(上行)。
func createPath() -> CGPath {
let height: CGFloat = 37.0
let path = UIBezierPath()
let centerWidth = self.frame.width / 2
path.move(to: CGPoint(x: 0, y: 0)) // start top left
path.addLine(to: CGPoint(x: (centerWidth - height * 2), y: 0)) // the beginning of the trough
// first curve down
path.addCurve(to: CGPoint(x: centerWidth, y: height),
controlPoint1: CGPoint(x: (centerWidth - 30), y: 0), controlPoint2: CGPoint(x: centerWidth - 35, y: height))
// second curve up
path.addCurve(to: CGPoint(x: (centerWidth + height * 2), y: 0),
controlPoint1: CGPoint(x: centerWidth + 35, y: height), controlPoint2: CGPoint(x: (centerWidth + 30), y: 0))
// complete the rect
path.addLine(to: CGPoint(x: self.frame.width, y: 0))
path.addLine(to: CGPoint(x: self.frame.width, y: self.frame.height))
path.addLine(to: CGPoint(x: 0, y: self.frame.height))
path.close()
return path.cgPath
}