将多个视图推入堆栈而不看到中间的视图

发布于 2024-12-20 11:32:46 字数 255 浏览 2 评论 0原文

我试图在应用程序的多个部分之间切换时给我的应用程序一种持久的感觉。 当他们点击一个图标时,我希望它直接打开到我所在的视图控制器,但是,我需要让视图控制器堆栈保持与他们离开我的应用程序的该部分时相同。

我似乎最早可以呈现另一个视图控制器是在“viewDIDAppear”方法中,这是有问题的,因为用户在我推动每个视图时看到我正在浏览每个视图。

使用 NSOperationQueue 呈现视图控制器会帮助我实现这个结果。最终,我无法让用户看到我逐步完成每个 VC。

I am trying to give my application a feeling of persistance when switching between multiple parts of the application.
When they tap on an icon I want it to open directly to the view controller that I was on however, I need to get the View Controller stack to stay the same as it was when they left that part of my app.

The earliest I can seem to present another view controller is in the "viewDIDAppear" method which is problematic because the user sees me going through each view as I am pushing it.

Would presenting view controllers with a NSOperationQueue help me achieve this result. Ultimately I just can't have the user see me stepping through every VC.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

余生再见 2024-12-27 11:32:46

似乎与将多个视图控制器推送到导航控制器堆栈上的问题重复

依次推动所有控制器,但仅对最后一次推动进行动画处理。

Seems to be duplicate of Problem pushing multiple view controllers onto navigation controller stack

Push all your controllers one after another but animate only the last push.

皓月长歌 2024-12-27 11:32:46

当你说“堆栈”时,我会问,你想拥有多少个 UIViewCOntrollers ?因为,你会遇到内存问题吗?您有 viewWillAppear,它发生在 viewDidAppear 之前。

When you say "stack" I ask, how many UIViewCOntrollers are you thinking on having? Because, you can run into memory problems? You have viewWillAppear, that happens before viewDidAppear.

疯了 2024-12-27 11:32:46

您需要在应用程序委托方法中执行此操作,

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

这就是我通过保存应用程序状态来完成的方法,

- (void)applicationDidEnterBackground:(UIApplication *)application

然后当用户完全关闭应用程序后打开应用程序时,它会从他们离开的地方启动。

如果您需要有关如何持久化等的更多信息,我可以提供一些示例,尽管它们确实使用导航控制器。

You need to do it in the app delegate method

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

That's how I have done it with a saving of the app state done in

- (void)applicationDidEnterBackground:(UIApplication *)application

Then when the user opens the app after fully closing it down it starts up where they left it.

If you need further information on how to persist etc I can provide some examples although they do use a navigation controller.

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