有没有办法找出应用程序进入后台iOS的原因?

时间:2015-11-17 18:23:54

标签: ios

我希望能够根据应用程序输入背景的原因做不同的事情。例如:按下主页按钮,位置服务权限。

有没有办法找出来?

1 个答案:

答案 0 :(得分:0)

您可以通过app委托方法收听应用程序状态。这将确定您的应用程序所处的状态。

https://developer.apple.com/library/prerelease/ios/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/index.html

您还可以注册与这些状态相关的通知。有关其他示例,请参阅此帖子。

What's the best way to detect when the app is entering the background for my view?

我相信你会看到这两个事件的不同通知状态。

相关问题