How to set top left and right corner radius with desired drop shadow in UITabbar?

后端 未结 5 674
萌比男神i
萌比男神i 2021-01-05 03:05

I\'ve spent almost a couple of hours to figure it out. However, it did not happen and finally, I had to come here. Two things are required to be achieved: <

5条回答
  •  悲哀的现实
    2021-01-05 03:26

    Try this for iOS 11.0+

    import UIKit
    class MainTabBarController: UITabBarController{
        override func viewDidLoad() {
            super.viewDidLoad()
    
            tabBar.layer.cornerRadius = 20
            tabBar.layer.maskedCorners = [.layerMinXMinYCorner,.layerMaxXMinYCorner]
        }
    }
    

提交回复
热议问题