码迷,mamicode.com
首页 > 移动开发 > 详细

iOS通过代码关闭程序

时间:2016-02-25 13:53:51      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:

//-------------------------------- 退出程序 -----------------------------------------//

- (void)exitApplication {

    [UIView beginAnimations:@"exitApplication" context:nil];

    [UIView setAnimationDuration:0.5];

    [UIView setAnimationDelegate:self];

    // [UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.view.window cache:NO];

    [UIView setAnimationTransition:UIViewAnimationCurveEaseOutforView:self.window cache:NO];

    [UIViewsetAnimationDidStopSelector:@selector(animationFinished:finished:context:)];

    //self.view.window.bounds = CGRectMake(0, 0, 0, 0);

    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);

    }

}

iOS通过代码关闭程序

标签:

原文地址:http://www.cnblogs.com/zxykit/p/5216642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!