为什么我不能弹出导航堆栈中的最后一个视图?

时间:2014-09-16 12:13:52

标签: ios objective-c uinavigationcontroller

我想在我的应用中弹出最后一个视图,所以我正在调用此函数:

[self.navigationController popViewControllerAnimated:YES];

和self是最后一个视图控制器,我希望应用程序退出,但这不会发生原因?

2 个答案:

答案 0 :(得分:1)

要进入rootView,你需要调用如下,

    [self.navigationController popToRootViewControllerAnimated:YES]; // Returns the root/last vie controller.

,你使用的是下面的,

[self.navigationController popViewControllerAnimated:YES]; // Returns the popped controller.

答案 1 :(得分:0)

如果您想退出自己的应用,请执行以下操作:

[[NSThread mainThread] exit]

无论如何,你的方式:

[self.navigationController popViewControllerAnimated:YES];

这在android中很常见,而不是在iOS中。

相关问题