ios - 检测到应用程序启动进入后台状态?

标签 ios background uiapplicationdelegate

如何检测应用程序已启动进入后台状态?不用说普通应用程序无法做到这一点,只有一小部分适当类型的应用程序可以,这不是理想的情况。特别是报亭应用程序可以做到这一点。

最佳答案

很难相信还没有人正确回答这个问题。来自iOS App Progamming Guide :

To determine whether your app is launching into the foreground or background, check the applicationState property of the shared UIApplication object in your application:willFinishLaunchingWithOptions: or application:didFinishLaunchingWithOptions: delegate method. When the app is launched into the foreground, this property contains the value UIApplicationStateInactive. When the app is launched into the background, the property contains the value UIApplicationStateBackground instead. You can use this difference to adjust the launch-time behavior of your delegate methods accordingly.

关于ios - 检测到应用程序启动进入后台状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8479903/

相关文章:

javascript - 使用 jquery 更改使用 Jquery 创建的元素的背景

ios - 关于应用进入暂停状态后点击应用图标后应用状态的问题

ios - 动画 block - 完成立即触发

ios - Xamarin 4 issue : iOS AOT problems which are not present in Xamarin 3. 怎么解决?

ios - 计算截断时 UILabel 中可见字符的数量 - Xcode Swift

ios - 我是否需要 ApplicationDelegate 函数中的 UIApplication* 应用程序?

ios - iOS 13 中未调用应用程序委托(delegate)方法

ios - 在 ViewDidLoad 期间 ViewModel 为空

windows-phone-7 - 如何在Windows Phone 7.5中关闭后台音频代理?

c++ - allegro5 (C++) 中的另一幅图像