从嵌入在 UITabBarController 中的 UIViewController 我执行模态 segue
self.present(.....
在我的 UITabBarController 中成为“自我”我的视图控制器。新的 ViewController 完美展现,姑且称之为模态ViewController2
呈现ViewController1
。如果我尝试关闭ViewController2
它,它总是会因未知异常而崩溃。libc++abi.dylib: terminating with uncaught exception of type NSException.
ViewController2
嵌入在 aUINavigationController
但这ViewController2
是唯一一个崩溃的。
我试过解雇presentingViewController
, presentationController
,presentedViewController
但self.navigationController?.dismiss
没有什么对我有用。
架构是:UITabBarController->ViewController1 -modally present- UINavigationController->ViewController2
这是我的演示代码:
guard let vcDetail = UIStoryboard(name: "ProjectDetailStoryBoard\(currentDevice)", bundle: nil).instantiateViewController(withIdentifier: "vcDetailProject") as? ProjectDetailController else{return}
vcDetail.instantiatedFromPushNotification = true
vcDetail.projectId = key
let vc = UINavigationController(rootViewController: vcDetail)
UIApplication.topViewController()?.present(vc, animated: true, completion: nil)
这是我的解雇代码:
@IBAction func dismissView(){
dismiss(animated: true, completion: nil)
}