Navigation bar not showing iOS swift

前端 未结 7 1634
醉话见心
醉话见心 2021-02-18 13:24

I am having multiple view controller in my application. I want to hide navigationbar in my first view controller. So I use the following code to hide the navigation

7条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-18 13:52

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
    
        // Hide the navigation bar on the this view controller
        self.navigationController?.setNavigationBarHidden(true, animated: animated)
    }
    
    override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
    
        // Show the navigation bar on other view controllers
        self.navigationController?.setNavigationBarHidden(false, animated: animated)
    }
    

提交回复
热议问题