我正在使用的应用程序中,我调用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
发布评论