假设我有 3 个ViewControllers
标记为“A”、“B”和“C”。现在,“A”是rootViewController
窗口的形状,它以模态方式呈现“B”。当点击“B”中的按钮时,应该立即以模态方式呈现 C 并自动关闭“B”。我怎样才能做到这一点?我在 StackOverflow 中看到了所有示例,但它们不起作用
@IBAction func proceedBtnTapped(_ sender: Any) {
weak var pvc = self.presentingViewController
let vc = ThirdViewController()
pvc?.present(vc, animated: true, completion: { [weak self] in
self?.dismiss(animated: true, completion: nil)
})
}
这是我的代码。有什么帮助吗?
首先驳回你的b查看控制器然后呈现c视图控制器打开A.
尝试这个。
let vc = ThirdViewController()
let navVC = UINavigationController(rootViewController: vc)
if let parent = self.presentingViewController{
self.dismiss(animated: true){
parent.present(navVC, animated: true)
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)