J.Chen
J.Chen

Reputation: 51

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

Upvotes: 1

Views: 162

Answers (1)

Reinier Melian
Reinier Melian

Reputation: 20804

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()
}

Upvotes: 1

Related Questions