美文网首页
iOS 强制退出APP

iOS 强制退出APP

作者: 缘來諟夢 | 来源:发表于2020-12-24 16:04 被阅读0次

方法一:

// 退出应用程序
- (void)exitApplication{
    AppDelegate *app = (AppDelegate*)[UIApplication sharedApplication].delegate;
    UIWindow *window = app.window;
    [UIView animateWithDuration:0.4f animations:^{
        CGAffineTransform curent =  window.transform;
        CGAffineTransform scale = CGAffineTransformScale(curent, 0.1,0.1);
        [window setTransform:scale];
    } completion:^(BOOL finished) {
        exit(0);
    }];
}

方法二:

[[UIApplication sharedApplication] terminateWithSuccess];

相关文章

网友评论

      本文标题:iOS 强制退出APP

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