问题描述
-
我有
TabsViewController
,其中3个Tabs
由UINavigationControllers
发起。 -
当我切换
tabs
#2和#3时,我想返回时在popUpViewController
#1接收最新的tab
。 -
问题是如果您调用
.overCurrentContext
,当您从另一个tab
返回时它将消失,但是其他viewControllers
仍然显示正确地放在NavigationController
堆栈上。// AGREEMENT @IBAction func btnpressed(_ sender: Any) { if let vc = storyboard?.instantiateViewController(withIdentifier: "AgreementVC") as? AgreementVC { vc.callBack = { (id: String,name: String,age: Int) in print(id,name,age) // change the state for parent view self.agree.setimage(UIImage(named: "CheckBoxTrue"),for: .normal) self.send.isHidden = false } vc.modalPresentationStyle = .overCurrentContext vc.modalTransitionStyle = .crossdissolve self.navigationController?.present(vc,animated: true) } }
-
我的想法是检查
PresentedViewController
和dismiss
AgreementVC()
是否在内存中之前:override func viewDidAppear(_ animated: Bool) { if self.navigationController?.presentedViewController == AgreementVC(){ print("+ the popUpView was here") self.navigationController?.dismiss(animated: false,completion: nil) } else { print("- no popUpView") } }
当我切换不带popUp的选项卡时-是确定,但是如果我确实打开popUpVC,则会出现错误(该错误仍然存在,但是会从图形中消失用于用户屏幕):
警告:尝试提出
在 上 呈现
如何正确检查显示的ViewController? 此问题适用于未从其他StackOverFlow主题获得答案的人。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)