Search code examples
iosobjective-cuitabbarios13

iOS13 system UITabBar


How to remove the black line at the top of tab,

[self.tabBar setShadowImage:[UIImage new]];
self.tabBar.backgroundImage = [UIImage new];

iOS13 invalid

enter image description here


Solution

  • You need to use the new UITabBarAppareance for iOS 13

    if #available(iOS 13.0, *) {
        let appareance = UITabBarAppearance(barAppearance: tabBarController.tabBar.standardAppearance)
        appareance.shadowImage = nil
        appareance.shadowColor = nil
        tabBarController.tabBar.standardAppearance = appareance
    } else {
        // Fallback on earlier versions.
        tabBarController.tabBar.shadowImage = UIImage()
    }