问题描述
我有一个文件,我在其中定义控制器的外观以及定义约束和其他内容,在这里我还像下面的按钮之一声明了一个addtarget
nextButton.addTarget(self,action: #selector(nextButtonTapped),for: .touchUpInside)
并定义方法,现在一切正常,但是在控制器页面上关闭modalView的代码没有响应,从视图文件调用的关闭代码的任何变化在控制器上都不起作用,其他一切正常,但是不解雇
@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)