LuckyLuke
LuckyLuke

Reputation: 49087

What should I do when the user taps home button

I am making an application with three tabs. One of the tabs has a question-test while the other tabs show some tableviews with a navigation hierarchy. Obviously I want to return to the state which the user had when he/she left it in.

I probably need to register for notifications sent to the application delegate, correct? And what do I need to save? Do I need to save things such as with tab and which "stage" in the tableview hierarchy the user were in, or just the state?

The application delegate already has methods which is invoked during the life cyclus of the app, but I do not pass all the data to the delegate, and then let the invoked method in the delegate to handle the saving? I do as I already said, listen for notifications in each view controller?

Upvotes: 0

Views: 83

Answers (1)

grahamparks
grahamparks

Reputation: 16296

It's up to you how much of your application's state you choose to save. You can choose to save nothing (though Apple discourages this) if you're happy for your users to sometimes be dumped back at the home screen when they return to your app, or you can choose to save absolutely every minute detail of the app's state and write elaborate code to recreate it when the app reloads. Most likely you'll end up doing a compromise between the two.

And likewise, you can implement saving and restoring any way that fits with the architecture of your app. There's no standard way to achieve it.

Upvotes: 2

Related Questions