关闭

iOS 通过代码关闭应用程序

331人阅读 评论(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:UIViewAnimationCurveEaseOut forView:self.window cache:NO];


    [UIView setAnimationDidStopSelector:@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);


    }


}

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:182095次
    • 积分:3151
    • 等级:
    • 排名:第10952名
    • 原创:49篇
    • 转载:407篇
    • 译文:0篇
    • 评论:2条