我使用 Swift 打开第二个 View Controller ,如下所示:
let vwStartTransaction = self.storyboard!.instantiateViewControllerWithIdentifier("StartTransactionView") as TransactionViewController;
self.presentViewController(vwStartTransaction, animated: true, completion: nil);
然后,在第二个 View 中,我以相同的方式打开第三个 View 。
let vwConfirmTransaction = self.storyboard!.instantiateViewControllerWithIdentifier("ConfirmTransactionView") as ConfirmViewController;
self.presentViewController(vwConfirmTransaction, animated: true, completion: nil);
现在,当按下此确认 Controller 中的“确认”按钮时,我想关闭两个 View ,以便返回初始 View 。谁能告诉我最好的方法是什么?
最佳答案
为什么不使用一个 ViewController 然后显示两个 View 。然后你可以随意隐藏或显示它们,并在完成后关闭单个 VC。但是,如果您必须这样做,请解散一个 VC,并向另一个 VC 发送消息以将其也解散。
关于ios - 一次关闭 2 个 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26661128/