ios - iOS 中的不同背景模式

标签 ios swift ios-background-mode

为了识别我的应用程序进入了后台模式 [一次短按主页按钮] 我使用这个功能:

func applicationDidEnterBackground(_ application: UIApplication) {
    //...
}

但我如何识别我的应用程序进入了应用程序切换模式 [两次短按主页按钮]?在这种情况下,不会调用方法 applicationDidEnterBackground

最佳答案

试试这个:

    func applicationWillResignActive(_ application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
    }

关于ios - iOS 中的不同背景模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53864210/

相关文章:

ios - 自动调整 anchor 大小不会将 subview 设置为角点

swift - 我可以使用swift编程语言来开发框架吗?

ios - 有没有办法检查iOS应用程序是否在后台?

swift - iOS 13 - WkWebView : audio stops when in background

ios - iOS 后台模式下本地主机没有响应

ios - 在 Swift 上创建 UITableView 单元格

ios - 如何在 UITableViewCell 后台实现实时 iOS 7 模糊效果

ios - 当 iOS 应用程序被暂停/终止并且用户点击通知时如何处理 Firebase 推送通知?

ios - 如何使表格单元格展开和折叠

ios - 如何在 SpriteKit 中使用不同大小的纹理制作动画