How to dismiss a navigation controller presented f

2019-08-20 06:16发布

问题:

I'm presenting a UINavigationController from another UINavigationController like this:

let customNavigationController = CustomNavigationController()
customNavigationController.viewControllers = [myController]
customNavigationController.modalPresentationStyle = .custom

self.navigationController.present(customNavigationController, animated: true, completion: nil)

Then, when a "close" button tapped, I try to dismiss it like this:

navigationController.dismiss(animated: true, completion: nil)

That works on iOS 11, but it is not working neither in iOS 9 nor iOS 10. What I'm missing or doing wrong?