iOS 退出App 的方式有许多,介绍其中一种:在.m 文件中添加如下代码:
iOS 退出App 的方式有许多,介绍其中一种:
1. 在AppDelegate.m 文件中添加如下代码:
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
exit(0);
}
2. 在需要退出的地方调用:
[[UIApplication sharedApplication] performSelector:@selector(terminateWithSuccess)];
这样就可以实现iOS App 的退出。
本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处
评论列表(43条)