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 中退出应用程序


基础教程推荐
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01