如何让我的iPhone应用程序从显示的特定屏幕开始? [英] How can I have my iPhone app start with a specific screen showing?

查看:76
本文介绍了如何让我的iPhone应用程序从显示的特定屏幕开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大应用程序,其中有很多屏幕,所有屏幕都按层次结构排列,顶部是UITabBarController,下面是UINavigationControllers,然后是UIView Controllers,也许还有一个模态控制器,可以很好地投入使用. /p>

允许用户从列表中选择开始屏幕.选择后,下次启动该应用程序时,它将从指定的屏幕开始,并且所有导航都将像他们自己在此处导航一样工作.

由于我无法继承UITabBarController和UINavigationController,因此无法添加任何ivars来设置任何初始导航信息.

那么在这种情况下,最好的方法是建立层次结构并显示正确的视图控制器的屏幕,并迅速进行操作?

解决方案

您将要退出前退出NSCoder并保存视图层次结构.这样,要加载它们,您只需反序列化视图层次结构,并且状态应该相同.

I have a big app with lots of screens, all arranged in a hierarchy, with a UITabBarController at the top, UINavigationControllers below that, and then UIView Controllers below those, maybe with a modal controller somewhere thrown in for good measure.

The user is allowed to pick a start screen from a list. Once selected, next time the app is started it will start from the specified screen and all the navigation will work as if they had navigated there themselves.

Since I can't subclass UITabBarController and UINavigationController, I can't add any ivars to set any initial navigation information.

So what is the best way get the hierarchy set up and the screen of the correct view controller showing under these conditions, and do it quickly?

解决方案

You will want to check out NSCoder and save the view hierarchy before exit. This way, to load them up, you just unserialize the view hierarchy and the state should be the same.

这篇关于如何让我的iPhone应用程序从显示的特定屏幕开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆