quit app in iOS4(在 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 中退出应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 iOS4 中退出应用程序


基础教程推荐
- iOS4 创建后台定时器 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01