-3

I have found many apps where you can press a button or something similar and the application will terminate and bring you back to the home screen. How would I do this?

iTz Sillohsk8
  • 183
  • 1
  • 2
  • 6

2 Answers2

1

exit(0);

this can exit the app .

again, the best way I think will be like as follows:

    //@step invoke the normal routine applicationWillTerminate
if ([[UIApplication sharedApplication].delegate respondsToSelector:@selector(applicationWillTerminate:)]) 
{
    [[UIApplication sharedApplication].delegate performSelector:@selector(applicationWillTerminate:) withObject:[UIApplication sharedApplication]];
}
//@step force quite app
kill(getpid(), SIGINT); 

I got it from other post on the overflow :D

iXcoder
  • 1,564
  • 4
  • 20
  • 41
0

from http://www.iphonedevsdk.com/forum/iphone-sdk-development/6928-exit-application.html

[[UIApplication sharedApplication] terminateWithSuccess];
John Boker
  • 82,559
  • 17
  • 97
  • 130