第一种采用block方式:
[UIView animateWithDuration:0.3 animations:^{
[UIApplication sharedApplication].keyWindow.transform = CGAffineTransformMakeScale(0.01f, 0.01f);
} completion:^(BOOL finished) {
exit(0);
}];
第一种采用代理方法:
- (void)exitApplication{
[UIView beginAnimations:@"exitApplication" context:nil];
[UIView setAnimationDuration:0.3];
[UIView setAnimationDelegate:self];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft 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);
}
}