Ios – Hide tab bar in IOS swift app


I'm trying to figure out how to hide the tab bar in my iOS swift app. I don't care about any fancy animations or anything. Just something I can put in the ViewDidLoad() function.

Best Answer

You can simply use this in your ViewDidLoad() method.

self.tabBarController?.tabBar.hidden = true

For Swift 3.0, 4.0, 5.0:

self.tabBarController?.tabBar.isHidden = true

Or you can change z position of tab bar this way:

self.tabBarController?.tabBar.layer.zPosition = -1

and if you want to show it again then:

self.tabBarController?.tabBar.layer.zPosition = 0