hide tab bar in view with push

前端 未结 7 1829
离开以前
离开以前 2021-02-03 22:51

I have a tabBar + NavigationViewController. The Tab bar has collection view with cells(Say view1) and with cells a push seag

7条回答
  •  忘掉有多难
    2021-02-03 23:01

    You have to work with viewWillAppear or viewDidAppear. viewDidLoad will be called when view1 is loading (showing) the first time. If you move from view1 to view2 and back the viewDidLoad won't be called again. Therefore you have to use viewWillAppear or viewDidAppear like

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    
        self.tabBarController?.tabBar.hidden = false
    }
    

    Put this code in your view1 controller. The viewWillAppear or viewDidAppear will be called every time navigating back to view1

提交回复
热议问题