Hide tab bar in IOS swift app

后端 未结 8 2235
走了就别回头了
走了就别回头了 2020-12-22 19:19

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

8条回答
  •  滥情空心
    2020-12-22 19:44

    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
    

提交回复
热议问题