I have made a small test app with a button and a UISlider. Touching the button changes its label text.
I have added IBOutlet properties for both controls. I’m releasing all properties in viewDidUnload and also set them to nil in dealloc.
The interesting thing is now: I touch the button. Its tag is changed from “0” to “1” and, its text is updated: tag == 1 -> “B”, tag == 0 -> “A”. So the text says “B” now.
Then I close the App (iPhones home button) and restart it.
Still the button says “B”! How is that possible? Is the App not terminated?
Running on iOS4.1 here on an iPhone 4.
René
You’re right. The app is not terminated. In iOS 4, apps are suspended when the home button is pressed. When you “relaunch” the app, it is simply moved to the foreground. This is why your application state isn’t changing. Note: Once suspended, apps may be terminated by the OS without notification, so make sure to do all your saving before the app gets suspended, e.g., in
applicationDidEnterBackground:.