views:

304

answers:

1

If I add an observer for UIApplicationWillTerminateNotification in a UIViewController, it fires after viewWillDisappear.

I have some code in the viewWillDisappear that needs to take a different action based on weather or not the application has been terminated or simply unloaded.

Can anyone suggest what could be done in this situation ?

TIA!

A: 

A crude hack, but you could add a boolean ivar which you set in applicationWillTerminate and then check it in viewWillDisappear

David Kanarek
But the viewWillDisappear gets called BEFORE applicationWillTerminate... so the order of operation is all wrong.
dizy
Oh darn. Is it possible to do the reverse: have it set normally, and anytime you willingly unload the view unset it before doing so? It's even less elegant than before but I don't know of anything in the API for this, someone must though. Could you explain why you have to do something different?
David Kanarek