当我点击模式弹出式ViewController
中的取消按钮时,出于某种原因,它会转到navigation
堆栈的最开头,而不是返回到viewController
那个叫它。我做错了吗?
堆栈的根,调用ViewControllerA:
class RootViewController {
let viewController = ViewControllerA(contact: selectedContact)
self.navigationController!.pushViewController(viewController, animated: true)
}
ViewControllerA /调用模式:
let viewController = ViewControllerB()
let navigationController = UINavigationController(rootViewController: viewController)
self.present(navigationController, animated: true, completion: nil)
ViewControllerB /解除模态:
@objc func cancelButtonPressed() {
self.dismiss(animated: true, completion: nil)
}