本文介绍了在通过五个屏幕转换后,回到我的iPhone应用程序的第一个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中使用多个屏幕。我编写了从第一个屏幕移动到第二个屏幕,第二个屏幕移动到第三个屏幕的代码,依此类推到第五个屏幕。

I'm using multiple screens in my app. I wrote code for the moving from the first screen to the second screen, the second screen to the third screen, and so on up to the fifth screen.

现在我想跳到第五个屏幕的第一个屏幕,但我想这样做而不创建第一个屏幕的另一个实例,因为这会导致内存问题。

Now I want to jump to the first screen from the fifth screen, but I want to do this without creating another instance of the first screen, as that would cause memory problems.

请建议在这种情况下该怎么办?

Please suggest what to do in this case?

推荐答案

[self.navigationController popToRootViewControllerAnimated:YES];

[self.navigationController popToRootViewControllerAnimated:YES];

[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];

[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:0] animated:YES];

您可以使用第二行代码然后验证视图控制器的索引。

You can use second line code then verify the index of view controller.

并且您有内存问题所以请验证任何对象是否释放。

and you have memory problem so please verify the any object release or not.

这篇关于在通过五个屏幕转换后,回到我的iPhone应用程序的第一个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 14:47