iOS - 直接退出应用

2016-03-18  本文已影响434人  Mitchell
//使用
-(void)touchesBegan:(NSSet<UITouch *> *)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);
 }
}
上一篇 下一篇

猜你喜欢

热点阅读