IOS Saving State For Complex Apps

后端 未结 4 709
后悔当初
后悔当初 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:26

    I would suggest keeping the state of each tab view. Only at the "page" level. Don't worry about popovers or incomplete data entry (hopefully there's not too much interim state before you're saving it to your core data store.)

    Like you said, it's easy enough to remember what tab you're on, and what controller you're navigated to in each tab. More isn't necessary.

    It sounds like you've got it under control, but for the benefit of others: 1) when you change tabs, save "active tab", 2) when you navigate within a tab, save "active controller in tab", 3) when you launch the app, set the "active tab", 4) when you change tabs, set/confirm the "active controller in tab".

    The reason for 4) is that the view/controllers for the tabs will be delayed in their loading, or perhaps never loaded. You don't want to set the "active controller in tab" for a tab that is not visible and may never be loaded into the app, it would just cause unnecessary loading. It will often happen (after the app has been loaded) that you don't need to change it because it's already in the correct state.

提交回复
热议问题