我已经成功地创建了一个自定义的圆形浮动标签栏,但我如何删除默认的标签栏(如图中箭头所示)。我试图将标签栏背景设置为UIImage()并将背景颜色设置为Clear,但仍然不起作用。我的代码:
let layer = CAShapeLayer()
guard let tabBar = tabBarController?.tabBar else {return}
layer.path = UIBezierPath(roundedRect: CGRect(x: 30,
y: tabBar.bounds.minY + 5,
//y: tabBar.bounds.minY - 28,
width: tabBar.bounds.width - 60,
height: tabBar.bounds.height - 24),
cornerRadius: (tabBar.frame.width / 2)).cgPath
layer.shadowColor = UIColor.lightGray.cgColor
layer.shadowOffset = CGSize(width: 5.0, height: 5.0)
layer.shadowRadius = 25.0
layer.shadowOpacity = 0.3
layer.borderWidth = 1.0
layer.opacity = 1.0
layer.masksToBounds = false
layer.fillColor = UIColor.white.cgColor
tabBar.layer.insertSublayer(layer, at: 0)
2条答案
按热度按时间bvpmtnay1#
使用选项卡栏外观:
4nkexdtk2#
所有iOS版本