I want to hide navigation bar in a particular view controller in my TabBarController
Following is code in my first view controller of tabbar
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
self.navigationController?.setNavigationBarHidden(true, animated: false)
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(true)
self.navigationController?.setNavigationBarHidden(false, animated: false)
}
But sometimes when I change tabbar selection viewWillAppear is not called also if I present view from this controller viewWillAppear is not called on dismissal of presented controller.
Due to which facing issues. how to fix this?
Also viewWillDisappear is not called if I push a view controller following is code for it
let flightVC = AppStrings.appStoryBoard.instantiateViewController(withIdentifier: "flightViewPagerControllerID") as! FlightViewPagerController
self.navigationController?.pushViewController(flightVC, animated: true)