【发布时间】:2019-06-24 17:53:32
【问题描述】:
我的场景,我有三个ViewControllers,那些ViewControllers 第一个、第二个、第三个。在这里,首先ViewControllerUIButton点击展示模型第二个ViewController然后第二个ViewControllerUIButton点击展示模型第三个ViewController。我需要实现第二个ViewController 按钮单击以在呈现第三个ViewController 后关闭当前ViewController,因为一旦我关闭第三个ViewController,我需要显示第一个ViewController。如何做到这一点?
注意:我正在为第三个 ViewController 使用 NavigationController,我也在使用 Storyboard。
这是我的代码:
@IBAction func ClickThirdVC(_ sender: Any) {
if let VC_Third = self.storyboard?.instantiateViewController(withIdentifier: "thirdviewcontroller") as? ThirdvViewController {
weak var pvc = self.presentingViewController
VC_B.modalTransitionStyle = .crossDissolve
let navController = UINavigationController(rootViewController: VC_B)
self.dismiss(animated: true, completion: {
pvc?.present(navController, animated: true, completion: nil)
})
}
}
【问题讨论】:
标签: swift uinavigationcontroller