Iphone: Is it possible to hide the TabBar? (Pre-iOS 8)

后端 未结 16 1605
广开言路
广开言路 2020-12-05 04:23

I have an application that uses a UITabBarController to switch between modes. When in a certain mode, I\'d like to hide the tab bar until the steps of that mode

16条回答
  •  無奈伤痛
    2020-12-05 05:26

    I tried a number of the solutions above, but no joy in iOS 8. I find that setting in viewWillAppear the following works for me. Should work in iOS 7 as the extendedLayoutIncludesOpaqueBars was introduced then.

        self.extendedLayoutIncludesOpaqueBars = true
        self.tabBarController?.tabBar.isHidden = true
        self.tabBarController?.tabBar.isOpaque = true
    

    and if you need to turn tabBars on again when you leave to use the following in viewWillDisappear.

        self.tabBarController?.tabBar.isHidden = false
        self.tabBarController?.tabBar.isOpaque = false
    

    I use this to allow a return from a transition to keep the TabBar hidden. Not used it in a button action but if like me you find nothing above now works, this could be the basis of a programmable solution.

提交回复
热议问题