iOS Dismis 的 ViewController 堆栈
我正在开发一个iPhone应用程序,在其中我使用presentModalViewController方法将ViewController更改为2/3级别(例如Home-->Option-->Other-->More)。
现在我想让我的应用程序返回到第一个屏幕或 ViewController。如果我使用missModalViewControllerAnimated方法,它只会关闭当前的视图控制器。但我想清除堆栈并再次启动主屏幕。
感谢您的任何帮助。
I'm developing a iPhone App, in which I'm changing the ViewController using presentModalViewController method upto 2/3 levels (e.g. Home-->Option-->Other-->More).
Now I want to get my app back to first screen or ViewController. If I use dismissModalViewControllerAnimated method, it just dismisses the current view controller only. But I want to clear the stack and start the Home screen again.
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为每个级别正确设置代表。因此,如果您在 More 中按 Cancel 或 Done,它将调用类似
[other moreViewDidCancel]
的内容,其中您将调用dismissModalViewController:Animated:
并通知其父视图控制器(委托)应该解雇(so,[option otherViewDidCancel]
)等等直到顶层。Set the delegates properly for each level. So if you press Cancel or Done in More, it will call somehting like
[other moreViewDidCancel]
inside of which, you will calldismissModalViewController:Animated:
and notify its parent view controller (delegate) that is should dismiss( so,[option otherViewDidCancel]
) and so on till the top level.