0

I need code for terminating the application on a button click but termination should be done with basic animation....Can anyone suggest?

I tried with exit(0) and also by using

[[UIApplication sharedApplication] terminate];

but it terminates application roughly.........

priya
  • 11
  • 6
  • 3
    You should only let the user close the application by pressing the home button. It's against the default behavior which the user expects every app to follow. When 4.0 is out you'd definitely don't want to terminate your app... – bddckr Apr 23 '10 at 10:24
  • possible duplicate of http://stackoverflow.com/questions/355168/proper-way-to-exit-iphone-application – Brad Larson Apr 23 '10 at 12:28

1 Answers1

0
UIApplication *app=[UIApplication sharedApplication];
    SEL selector=@selector(terminateWithSuccess);
    if([app respondsToSelector:selector])
        [app performSelector:selector];
visakh7
  • 26,380
  • 8
  • 55
  • 69
dragon
  • 317
  • 4
  • 18
  • Hmm, terminate and terminateWithSuccess seem to me to be undocumented API (for pre-OS 4). Cannot legally speak to it for 4.x. My guess is that there's still no reliable way for an AppStore-distributed app to force-quit -- aside from intentionally crashing .... :-) – Joseph Beckenbach Apr 23 '10 at 15:18