IOS Saving State For Complex Apps

后端 未结 4 729
后悔当初
后悔当初 2021-02-03 13:48

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

In the opinion of some of your mor

4条回答
  •  有刺的猬
    2021-02-03 14:13

    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?

    The best way to think about this is to make sure the user never has to figure out why or how they got to where they are when the app first opens.

    This depends completely on the type of app you have and the length of time since the last open. It sounds like you have a fairly complex drill-down app so I think it is definitely best to remember the navigation stack, within a pre-determined time frame. I use the three20 framework which does this automatically for me, but if you were to implement it, it would be something like this:

    1. If the user opens up in the past 24 hours, open to the exact spot the left off
    2. If the user opens within a week, open to the main "section" or area of the app they were in
    3. If the user opens after a week has past, open to the root screen.

    Now of course, these values will differ based on your apps function and use cases, but you get the idea. By you making some broad assumptions about how people are using your app and when, you can increase the user experience by not shoving them so deep in your app when they won't remember how they got there.

    As for implementation, it is all just data.. You dont need to serialize live objects to store the stack, just implement the data needed to recreate the state on the next launch. What you need to store is highly dependent on your own setup... mileage will vary. I use NSUserDefaults to store all instance vars and the navigational stack through Three20. Check out TTNavigator for a great implementation.

提交回复
热议问题