hiding TabBar when rotating iPhone device to landscape

前端 未结 8 1597
旧时难觅i
旧时难觅i 2020-12-09 12:21

So here is what i have: A UITabBarController that handles different UIViewControllers. In one of the UIViewController i am trying to switch the view being displayed when the

8条回答
  •  执笔经年
    2020-12-09 12:36

    Subclass your TabBarController and hide the TabBar when needed:

    class tabBarVC: UITabBarController {
    
        override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
            if size.height < size.width {
                self.tabBar.hidden = true
            } else {
                self.tabBar.hidden = false
            }
        }
    
    }
    

提交回复
热议问题