IOS 保存复杂应用程序的状态 [英] IOS Saving State For Complex Apps

查看:27
本文介绍了IOS 保存复杂应用程序的状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 iPad IOS 4.2 上构建一个相当复杂的业务应用程序:4 个选项卡,每个选项卡上都有潜在的深度导航路径.

I'm building a fairly complex business application on the iPad IOS 4.2: 4 tabs, with potentially deep navigational paths on each tab.

您的一些更有经验的 IOS 开发人员认为,对于在启动之间(即在应用完全终止并随后重新启动之后)保存应用程序状态,用户的一般期望是什么?我正在使用 Core Data 并涵盖了所有数据问题,但我担心应用程序的导航树.如果用户在屏幕 3 上离开了第一个选项卡,在屏幕 4 上离开了第二个选项卡,在屏幕 2 上离开了第三个选项卡,他在此处留下新记录的条目半完成,并且在应用程序进入后台时处于,在屏幕 3 上的第 4 个选项卡上工作……您认为普通用户会希望应用程序在下次启动时记住所有这些内容吗?(我的直觉说是的,但我不确定要持续多久.)

In the opinion of some of your more experienced IOS developers, what would the general expectation of a user be with respect to saving application state between launches (i.e. after an app's been fully terminated and subsequently restarted)? I'm using Core Data and have all the data issues covered, but I'm concerned about the application's navigational tree. If the user had left the 1st tab on screen 3, the 2nd tab on screen 4, the third on screen 2, where he left the entry of a new record half-complete, and was, at the time of the app entering the background, working on the 4th tab on screen 3...do you think the average user would expect the application to remember all that the next time it launched? (My gut says yes, though I'm unsure for how long.)

如果答案是肯定的,您能否建议一个处理此问题的一般策略(我再次在这里谈论的是导航树,而不是核心数据的东西)?例如,如果导航控制器用作每个选项卡的根视图控制器,那么记录有关其导航堆栈的足够信息以便以后能够恢复它们就足够简单了.但是,诸如弹出框、警报/操作表或动态创建的模态 VC 之类的东西呢?每个视图控制器是否应该记录其 UI 对象的状态?如果是,推荐的方法是什么?

If the answer is yes, can you suggest a general strategy for handling this (and, again, I'm talking about the navigational tree here, not Core Data stuff)? For example, if navigational controllers were used as the root view controller for each tab, it would be simple enough to record enough info about their navigational stacks to be able to restore them later. But what about things like popovers, alert/action sheets, or modal VCs created on the fly? Should each view controller record the state of its UI objects and, if so, what is the recommended way to do this?

我知道这在很大程度上取决于用户,但我想了解这些问题的一般观点,即经验的声音.

I know a lot of this is up to the user, but I'm asking for the general perspective on these issues, i.e. the voice of experience.

推荐答案

原理上很简单,但在实践中会变得相当复杂,遍历导航层次结构并存储无法从数据中派生的内容型号.

It's pretty simple in principle, but it can get quite complex in practice, to go through your navigation hierarchy and storing stuff that can't be derived from the data model.

有一个名为 DTResurectionKit 的开源实现.我还在我网站上的应用程序中记录了我是如何做到这一点的.它类似于(但比)DTResurectionKit.

There's an open source implementation of this called DTResurectionKit. I also documented how I do it in my apps on my website. It's similar to (but simpler than) DTResurectionKit.

这篇关于IOS 保存复杂应用程序的状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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