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

查看:101
本文介绍了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天全站免登陆