在dismissModalViewControllerAnimated之后调用popToRootViewControllerAnimated

编程入门 行业动态 更新时间:2024-10-17 09:53:41
本文介绍了在dismissModalViewControllerAnimated之后调用popToRootViewControllerAnimated的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用的应用程序中,我调用presentModalViewController,一旦完成(调用dismissModalViewControllerAnimated:YES),它应立即调用popToRootViewControllerAnimated.

I am working application in which i calling presentModalViewController and once finished(calling dismissModalViewControllerAnimated:YES) it should immediately call popToRootViewControllerAnimated.

但是问题是dismissModalViewControllerAnimated:YES正常工作,但popToRootViewControllerAnimated之后却无法工作.

But the issue is dismissModalViewControllerAnimated:YES is working properly but popToRootViewControllerAnimatedis not working after it.

代码如下所示:

[self.navigationController dismissModalViewControllerAnimated:YES] ; [self.navigationController popToRootViewControllerAnimated:YES];

推荐答案

尝试如下操作:

[self.navigationController dismissModalViewControllerAnimated:YES] ; [self performSelector:@selector(patchSelector) withObject:nil afterDelay:0.3]; -(void)patchSelector{ [self.navigationController popToRootViewControllerAnimated:YES]; }

它不是那么整洁,但是应该可以工作.

It is not so neat but it should work.

更新: 您应该使用

[self dismissModalViewControllerAnimated:YES];

代替

[self.navigationController dismissModalViewControllerAnimated:YES] ;

呈现模式的对象是视图控制器,而不是导航控制器.

The object that is presenting the modal is the view controller, not the navigation controller.

更多推荐

在dismissModalViewControllerAnimated之后调用popToRootViewControllerAnimated

本文发布于:2023-10-09 05:48:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1474873.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:dismissModalViewControllerAnimated   popToRootViewControllerAnimated

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!