iOS Dismis 的 ViewController 堆栈

发布于 2024-12-28 13:49:44 字数 256 浏览 0 评论 0原文

我正在开发一个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小梨窩很甜 2025-01-04 13:49:44

为每个级别正确设置代表。因此,如果您在 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 call dismissModalViewController:Animated: and notify its parent view controller (delegate) that is should dismiss( so, [option otherViewDidCancel]) and so on till the top level.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文