IOS Program Switching background

Source: Internet
Author: User

1.

-(void) animationfinished: (nsstring*) Animationid finished: (nsnumber*) Finishedcontext: (void*) context{if([Animationid Compare:@"exitapplication"]==0) {exit (0);//Exit ApplicationNSLog (@"Stop"); }}-(Ibaction) Exit: (ID) sender{[uiviewbeginanimations:@"exitapplication"Context:nil];//Animation name[Uiviewsetanimationduration:6];    [Uiviewsetanimationdelegate:self]; [UIViewsetAnimationTransition:UIViewAnimationCurveEaseInOutforView:self.viewcache:NO]; //Animation mode//actions performed by the end of the animation[Uivie setanimationdidstopselector: @selector (animationFinished:finished:context:)]; Self.view.bounds=cgrectmake (0,0,0,0);//End of animation[uiviewcommitanimations]; }

2.

-(void) exitapplication {    *app = [uiapplication sharedapplication].  Delegate;     *window = App.window;        [UIView animatewithduration: 1.0f animations:^{        0;         = CGRectMake (000);    } completion:^(BOOL finished) {        exit (0);    }];    }

3.

Q: How to Exit iOS program       in code mode A: There are no APIs available to exit the iOS app normally.       in iOS, the user clicks the home key to close the app. Your app should meet the following criteria: it cannot invoke the method itself, but should take steps to interact with the user, indicating the nature of the problem and the behavior that the application might take, such as turning on WiFi, using location services, etc. for the user to choose to use;       warning: Do not use the Exit function. Calling exit will cause the user to feel that the program is crashing, that there will be no smooth transitions and animations when the home key is returned, and that using exit may result in loss of data because calling exit does not call -applicationwillterminate: Methods and Uiapplicationdelegate methods, and the Abort function and the Assert macro are recommended if you do need to forcibly terminate the program in development or testing .

IOS Program Switching background

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.