在我的应用程序中,我遇到以下错误:
Pushing the same view controller instance more than once is not supported
这是一些用户反馈的错误报告。我们尝试复制它但不能(双击按钮等)。这是我们用来打开视图控制器的行:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let editView = storyboard.instantiateViewControllerWithIdentifier("EditViewController") as! EditViewController
editView.passedImage = image
editView.navigationController?.setNavigationBarHidden(false, animated: false)
if !(self.navigationController!.topViewController! is EditViewController) {
self.navigationController?.pushViewController(editView, animated: true)
}
有人有什么想法吗?我已经做了一些研究,我们在 Stack 上覆盖了大多数答案,所以对如何调查有点茫然。
尝试这样做以避免将同一个 VC 推送两次:
if !(self.navigationController!.viewControllers.contains(editView)){
self.navigationController?.pushViewController(editView, animated:true)
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)