Search code examples
iosswiftuipageviewcontroller

how to hide navigation bar while transition in uipageviewcontroller swift


I have a uipageviewcontroller which I am pushing from other view controller following code :-

self.navigationController?.pushViewController(rideDetailsPageViewController, animated: true)

When I try to swipe in uipageviewcontroller navigation bar shows up. how to prevent this ?


Solution

  • If you want to hide navigation bar apply below code method of rideDetailsPageViewController

        override func viewWillAppear(_ animated: Bool) {
            super.viewWillAppear(animated)
            self.navigationController?.isNavigationBarHidden = true
        }
    
        override func viewWillDisappear(_ animated: Bool) {
            super.viewWillDisappear(animated)
            self.navigationController?.isNavigationBarHidden = false
        }