我正在使用 MZFormSheetPresentationController在 ViewController1 上显示为“弹出”ViewController2(按照建议嵌入到导航 Controller 中)。
我的 ViewController1 有一个搜索栏、一个 UISegmentedControl 和一个表格 View :
当用户单击搜索栏书签按钮时,会显示弹出窗口。
我想在用户单击“完成”按钮时关闭弹出窗口,并且使用 self.dismissViewControllerAnimated(true,completion: nil) 方法效果很好,但我正在寻找更多。我想再次呈现 ViewController1,以便 tableView 重新加载数据。 我尝试过:
self.dismissViewControllerAnimated(true, completion: nil)
print("Dismissed")
//goToTickets
let next = self.storyboard?.instantiateViewControllerWithIdentifier("myTabBar") as! UITabBarController
self.presentViewController(next, animated: true, completion: nil)
但是我得到这个错误:
Warning: Attempt to present on whose view is not in the window hierarchy!
弹出窗口消失了,但我无法呈现 ViewController。
我该怎么办?
提前致谢。
编辑
这是我的 ViewController2,标识符为“navigationFilter”
和我的标签栏:
最佳答案
当您正在尝试呈现下一个 ViewController 时,您必须等待完成处理程序,然后呈现下一个 View Controller ,如下所示:
self.dismissViewControllerAnimated(true, completion: {
let next = self.storyboard?.instantiateViewControllerWithIdentifier("myTabBar") as! UITabBarController
self.presentViewController(next, animated: true, completion: nil)
})
关于ios - View over view 打破层次结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37830043/