Skip to content

Instantly share code, notes, and snippets.

@guanqun
Created December 25, 2013 14:28
Show Gist options
  • Save guanqun/8123638 to your computer and use it in GitHub Desktop.
Save guanqun/8123638 to your computer and use it in GitHub Desktop.
quit ios app with animation
- (void)exitApplication {
[UIView beginAnimations:@"exitApplication" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.window cache:NO];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
self.window.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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment