UIViewController * presentingViewController = self.presentingViewController;
while (presentingViewController.presentingViewController) {
presentingViewController = presentingViewController.presentingViewController;
}
[presentingViewController dismissViewControllerAnimated:YES completion:nil];
从当前controller返回到跟视图,(当前controller需要二级跳转以上页面),通过循环遍历寻找到指定的rootViewController
在调用presentViewController:animated:completion:方法时,真正作为跳转的容器并不一定是调用这个方法的view controller,而是取决于modalPresentationStyle。例如,一个全屏的跳转必须由一个全屏的view controller来完成。如果当前的控制器不能满足,那么系统会自动沿着视图控制器的层级向上查找
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交