iOS UITabBar : Remove top shadow gradient line

前端 未结 15 1286
暖寄归人
暖寄归人 2020-12-02 08:59

I implemented a custom UITabBar and I still have this gradient/shadow on top of it. I added

[self.tabBar setBackgroundImage:[UIImage imageNamed:@\"navBarBotto

15条回答
  •  既然无缘
    2020-12-02 09:39

    This code works both iOS 13 and below

    if #available(iOS 13, *) {
        let appearance = self.tabBar.standardAppearance.copy()
        appearance.backgroundImage = UIImage()
        appearance.shadowImage = UIImage()
        appearance.shadowColor = .clear
        self.tabBar.standardAppearance = appearance
    } else {
        self.tabBar.backgroundImage = UIImage()
        self.tabBar.shadowImage = UIImage()
    }
    

提交回复
热议问题