模拟退出软件
1、iOS无法代码关闭软件,只能模拟出用户按Home键,将软件退出的效果:
- (void)exitApplication { AppDelegate *appdelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; UIWindow *window = appdelegate.window; [UIView animateWithDuration:1.0f animations:^{ window.alpha = 0; window.frame = CGRectMake(0, window.bounds.size.width, 0, 0); } completion:^(BOOL finished) { exit(0); }]; }