views:

78

answers:

2

Hi all,

I am building an app based on a navigation controller.

I would like that the user has the ability when he relaunches the app to see the last screen he saw when he quit the app.

It's exactly like in the mail app, when you push "home" while composing a mail, then when you go back to your mails you directly arrive on the mail you were writting.

I would first like to know what is the best solution (I don't think I can get that with NSuserdefaults...). Then, I would like to know if this solution is applicable to my app, considering that in my rootviewcontroller I download data locally which I parse, then display in the multiple navigation controller views....

Thanks in advance for your answers.

A: 

I've just solved this... not sure it is the most elegant way...

However, I basically track each push and pop myself on a stack, but I store objects rather than views. Each time something is pushed or popped off my stack I save it (takes no time).

When the application launches it looks for the stack file and then does several pushes (popping items off the loaded stack) but not animating each one. My hierarchy is (at its deepest) 4 items, and to the user it looks like it just opens on the object.

The stack is loaded from the file in the viewDidLoad method of my root controller.

buggles
A: 

Can u give me some code for example

Qasim Shah