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

后端 未结 5 710
萌比男神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条回答
  •  猫巷女王i
    2021-01-05 03:39

    Swift 5.3.1, XCode 11+, iOS 14 For using in storyboards:

    import UIKit
    
        class CustomTabBar: UITabBar {
            let height: CGFloat = 62
            
            override func awakeFromNib() {
                super.awakeFromNib()
                layer.masksToBounds = true
                layer.cornerRadius = 20
                layer.maskedCorners = [.layerMinXMinYCorner,.layerMaxXMinYCorner]
            }
        }
    

提交回复
热议问题