用代码控制退出APP

+ (void)exitApplication {

    AppDelegate *app = [UIApplication sharedApplication].delegate;

    UIWindow *window = app.window;

    

    [UIView animateWithDuration:0.4f animations:^{

        window.alpha = 1;

        CGFloat y = window.bounds.size.height;

        CGFloat x = window.bounds.size.width / 2;

        window.frame = CGRectMake(x, y, 0, 0);

    } completion:^(BOOL finished) {

        exit(0);

    }];

}

posted @ 2016-12-26 16:42  tryFighting  阅读(504)  评论(0编辑  收藏  举报