I have the method to check when the back button in navigation bar is press and the method go back to root page but for some reason when self.navigationController?.popToRootViewController(animated: true)
it only go back to the previous page. do anyone know how to go back to the root when navigation bar back button is pressed?
override func didMove(toParentViewController parent: UIViewController?) {
super.didMove(toParentViewController: parent)
if parent == nil{
self.navigationController?.popToRootViewController(animated: true)
}
}
In this question he is asking how to what method can he use to customise his back button. In my code its able to detect when user press on back button and self.navigationController?.popToRootViewController(animated: true)
is suppose to bring the page back to the root page, however there are somethings in the system preventing my app to go back to the root page.