Remove top line from TabBar

jcamacho picture jcamacho · Oct 4, 2016 · Viewed 17.3k times · Source

On iOS 10 this code doesn't work in order to remove the tabBar shadow line:

[[UITabBar appearance] setShadowImage:[[UIImage alloc] init]];

Somebody knows, what must I do to remove it?

On iOS 9.3 with this two lines the line is removed, but iOS 10 ignores setShadowImage command.

Answer

sahiljain picture sahiljain · Jan 21, 2018

removes the topline for @iOS 13.0

let appearance = tabBar.standardAppearance
appearance.shadowImage = nil
appearance.shadowColor = nil
tabBar.standardAppearance = appearance;

removes the topline for iOS 12.0 and earlier

tabBar.shadowImage = UIImage()
tabBar.backgroundImage = UIImage()