在按下home键时退出应用程式 [英] Quit app when pressing home
问题描述
我的测试,当我退出(通过按主页按钮)我的应用程序,它仍然是运行在后台,由于多任务功能。但是,我希望当按下主页按钮时退出。这只会发生在我身上吗?
I my testing, when I exit (by pressing the home button) my app, it still is "running" in the background, thanks to the multitasking feature. However, I would like it to quit when the home button is pressed. Is this only happening to me?
无论如何,我已经跟踪到 applicationWillResignActive
$ c> applicationDidBecomeActive 方法。这些被称为多任务,但是当我想终止,应用程序辞职活动。非常感谢您对此问题的任何指导。
Anyway, I have tracked it down to the applicationWillResignActive
and the applicationDidBecomeActive
methods in the app delegate. These get called for multitasking, but when I want to terminate, the app "resigns active." Any guidance on this issue is greatly appreciated!
推荐答案
您的应用程序可以选择停止多任务(请参阅相应栏目在iPhone应用程序编程指南中),将 UIApplicationExitsOnSuspend
键添加到Info.plist并将其值设置为YES。
Your application can opt out of multitasking (see the appropriate section in the iPhone Application Programming Guide) by adding the UIApplicationExitsOnSuspend
key to your Info.plist and setting its value to YES.
在实践中,苹果强烈建议你不要这样做,除非你有非常好的理由这种行为。
In practice, Apple strongly recommends you not do this unless you have a very good reason for this behavior.
这篇关于在按下home键时退出应用程式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!