One way to actively exit IOS applications

Source: Internet
Author: User

The iPhone SDK only provides the following APIs to exit the application:

[CPP]
View plaincopy
  1. Exit (0 );

 

However, if this method does not have the animation effect, you can exit the program directly, giving the user the feeling that the program has exited due to an exception.

There is also a way to exit the program on the Internet, that is, to use undisclosed APIs. This method is more unreliable, because the use of undisclosed APIs cannot be declared through the appstore, in addition, the test in MySQL 4.0 is invalid.

You can only use exit (0) to exit the application. Considering that this method only lacks the animation effect when exiting, you can add an animation and call exit to exit the program after the animation is completed.

[CPP]
View plaincopy
  1. -(Void) exitapplication {
  2. [Uiview beginanimations: @ "exitapplication" context: Nil];
  3. [Uiview setanimationduration: 0.5];
  4. [Uiview setanimationdelegate: Self];
  5. [Uiview setanimationtransition: uiviewanimationcurveeaseout forview: Self. Window cache: No];
  6. [Uiview setanimationdidstopselector: @ selector (animationfinished: Finished: context :)];
  7. Self. Window. bounds = cgrectmake (0, 0, 0, 0 );
  8. [Uiview commitanimations];
  9. }
  10. -(Void) animationfinished :( nsstring *) animationid finished :( nsnumber *) finished context :( void *) Context {
  11. If ([animationid compare: @ "exitapplication"] = 0 ){
  12. Exit (0 );
  13. }
  14. }

The iPhone SDK only provides the following APIs to exit the application:

[CPP]
View plaincopy
  1. Exit (0 );

 

However, if this method does not have the animation effect, you can exit the program directly, giving the user the feeling that the program has exited due to an exception.

There is also a way to exit the program on the Internet, that is, to use undisclosed APIs. This method is more unreliable, because the use of undisclosed APIs cannot be declared through the appstore, in addition, the test in MySQL 4.0 is invalid.

You can only use exit (0) to exit the application. Considering that this method only lacks the animation effect when exiting, you can add an animation and call exit to exit the program after the animation is completed.

[CPP]
View plaincopy
  1. -(Void) exitapplication {
  2. [Uiview beginanimations: @ "exitapplication" context: Nil];
  3. [Uiview setanimationduration: 0.5];
  4. [Uiview setanimationdelegate: Self];
  5. [Uiview setanimationtransition: uiviewanimationcurveeaseout forview: Self. Window cache: No];
  6. [Uiview setanimationdidstopselector: @ selector (animationfinished: Finished: context :)];
  7. Self. Window. bounds = cgrectmake (0, 0, 0, 0 );
  8. [Uiview commitanimations];
  9. }
  10. -(Void) animationfinished :( nsstring *) animationid finished :( nsnumber *) finished context :( void *) Context {
  11. If ([animationid compare: @ "exitapplication"] = 0 ){
  12. Exit (0 );
  13. }
  14. }
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.