美文网首页
iOS - 直接退出应用

iOS - 直接退出应用

作者: Mitchell | 来源:发表于2016-03-18 21:31 被阅读434次
//使用
-(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);
 }
}

相关文章

网友评论

      本文标题:iOS - 直接退出应用

      本文链接:https://www.haomeiwen.com/subject/ackhlttx.html