![](/img/trans.png)
[英]How to dismiss PopViewController for another ViewController
[英]How to dismiss a viewController from another location
我有一个文件,我在其中定义 controller 的外观和定义约束和其他内容,在这里我还在下面的按钮之一上声明了 addtarget
nextButton.addTarget(self, action: #selector(nextButtonTapped), for: .touchUpInside)
并定义方法,现在一切正常,但在 controller 页面上,关闭 modalView 的代码没有响应,一些从视图文件调用的关闭代码的任何变体在 controller 上不起作用,其他任何东西都有效但不关闭
@objc func nextButtonTapped()
{
let index = childController.currentIndex
print(index)
switch index {
case 0...1:
childController.forwardPage()
case 2:
// dismiss(animated: true, completion: nil)
//diss.getDisMiss()
self.presentingViewController?.dismiss(animated: true, completion: nil)
default:
break
}
updateUI()
}
你可以尝试的是。
self.view.window?.rootViewController?.dismiss(animated: true, completion: nil)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.