The OS SDK provides the following APIs to exit the application:
IOS code
- 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.
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.
IOS code
- -(Void) exitapplication {
- [Uiview beginanimations: @ "exitapplication" context: Nil];
- [Uiview setanimationduration: 0.5];
- [Uiview setanimationdelegate: Self];
- [Uiview setanimationtransition: uiviewanimationcurveeaseout forview: [uiapplication sharedapplication]. keywindow cache: No];
- [Uiview setanimationdidstopselector: @ selector (animationfinished: Finished: context :)];
- [Uiapplication sharedapplication]. keywindow. bounds = cgrectmake (0, 0, 0, 0 );
- [Uiview commitanimations];
- }
- -(Void) animationfinished :( nsstring *) animationid finished :( nsnumber *) finished context :( void *) Context {
- If ([animationid compare: @ "exitapplication"] = 0 ){
- Exit (0 );
- }
- }