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


基础教程推荐
- Android文本颜色不会改变颜色 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01