views:

56

answers:

2

hi,

Since iPhone 4 do takes the application to background thread, Is there a way to quit the application so that it is not in the background ? can we have a exit button in the screen ???

+1  A: 

From the iOS Application Programming Guide:

If you do not want your application to remain in the background when it is quit, you can explicitly opt out of the background execution model by adding the UIApplicationExitsOnSuspend key to your application’s Info.plist file and setting its value to YES. When an application opts out, it cycles between the not running, inactive, and active states and never enters the background or suspended states. When the user taps the Home button to quit the application, the applicationWillTerminate: method of the application delegate is called and the application has approximately five seconds to clean up and exit before it is terminated and moved back to the not running state.
Ben S
+1  A: 

If you specifically want an exit button, just call exit(0); when it's touchUpInsided.

mbehan