0

I have prepared a tab bar which has a square shape rectangle but I can't able to prepare a rectangle type shape of a tab bar button or UIButton or View. How can I prepare a tab bar or button or view as following gif file?

enter image description here

1 Answers1

0

You can try something like given below for each button:

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)

krishan kumar
  • 378
  • 6
  • 11