iOS - 直接退出应用

//使用
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self exitApplication];
}

//退出方法
- (void)exitApp {
[UIView beginAnimations:@"exitApplication" context:nil];
 [UIView setAnimationDuration:0.5]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view.window cache:NO]; 
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
 self.view.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);
 }
}

你可能感兴趣的:(iOS - 直接退出应用)