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 中退出应用程序
基础教程推荐
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
