gpt4 book ai didi

ios - 在 dismissModalViewControllerAnimated 之后调用 popToRootViewControllerAnimated

转载 作者:可可西里 更新时间:2023-11-01 03:48:19 25 4
gpt4 key购买 nike

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

但问题是dismissModalViewControllerAnimated:YES工作正常但popToRootViewControllerAnimated在它之后不工作。

代码如下:

[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];
}

它不是很整洁,但应该可以。

更新:你应该使用

 [self dismissModalViewControllerAnimated:YES];

代替

 [self.navigationController dismissModalViewControllerAnimated:YES] ;

呈现模态的对象是 View Controller ,而不是导航 Controller 。

关于ios - 在 dismissModalViewControllerAnimated 之后调用 popToRootViewControllerAnimated,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3852932/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com