quitting an application in iphone 4
Since iPhone 4 do takes the application to background thread, Is there a way to quit the application so that it is 开发者_StackOverflow社区not in the background ? can we have a exit button in the screen ???
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.
If you specifically want an exit button, just call exit(0); when it's touchUpInsided.
精彩评论