在 iOS4 中退出应用程序 [英] quit app in iOS4

查看:16
本文介绍了在 iOS4 中退出应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个旧应用程序,它在各种视图的 viewDidLoad 中进行了许多 UI 初始化工作.在 iOS4 的主页按钮中,只需将应用程序置于后台,这样重新启动应用程序时就不会调用 viewDidLoad.

I have an old app which did many UI initialization work in viewDidLoad of various views. In iOS4 home button just put the app in background so viewDidLoad won't get called when re-launching the app.

我不想将这些初始化过程放在 viewWillAppear 中,因为每次视图出现时都不需要重新初始化数据.

I don't want to put those initialization procedures in viewWillAppear as it is unnecessary to re-initialize the data every time the view appear.

当用户按下主页按钮时,我如何才能完全退出我的应用程序?或任何简单的方法来重新加载位于 tabBarController 内的视图控制器?

How can I completely quit my app when user press the home button? or any simple way to reload the view controllers that sit inside a tabBarController?

谢谢.

推荐答案

在你的应用的 Info.plist 文件中有一个键名为 UIApplicationExitsOnSuspend,将其设置为布尔值YES,这实际上会将主页按钮的功能恢复到iOS4之前的状态,并在点击主页按钮时完全退出您的应用程序.

There is a key in your app's Info.plist file called UIApplicationExitsOnSuspend, set it to the boolean YES, which will essentially revert the home button's functionality to pre-iOS4 and completely exit your app when the home button is tapped.

这篇关于在 iOS4 中退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆