iOS退出APP

主要用到了exit(0)函数,代码如下:加了个动画,类似电视荧幕关闭的效果

- (void)exitApplication {
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [UIView animateWithDuration:0.5f animations:^{
        window.alpha = 0;
        window.frame = CGRectMake(0, window.bounds.size.height / 2, window.bounds.size.width, 0.5);
    } completion:^(BOOL finished) {
        exit(0);
    }];
}

你可能感兴趣的:(iOS)