如何在swift中准备矩形标签栏?

问题描述 投票:0回答:1

我准备了一个标签栏,它有一个方形的矩形但我无法准备一个矩形类型的标签栏按钮或UIButton或View。如何准备标签栏或按钮或视图如下gif文件?

enter image description here

xcode user-interface swift3 uibutton uitabbar
1个回答
0
投票

你可以尝试下面给出的每个按钮:

let tabBar1Path = UIBezierPath()

let tabBar1Layer = CAShapeLayer()

tabBar1Path.move(to: CGPoint(x: 0, y: 0))

tabBar1Path.addLine(to: CGPoint(x: self.view!.frame.size.width * 0.25, y: 0))

tabBar1Path.addLine(to: CGPoint(x: self.view!.frame.size.width * 0.2, y: tabBarHeight))

tabBar1Path.addLine(to: CGPoint(x: 0, y: tabBarHeight))

tabBar1Path.addLine(to: CGPoint(x: 0, y: 0))

tabBar1Layer.path = trianglePath.cgPath

tabBar1Layer.fillColor = UIColor.black.cgColor

tabBarButton1.layer.addSublayer(triangleLayer)

© www.soinside.com 2019 - 2024. All rights reserved.