How to react to applicationWillResignActive from anywhere?

前端 未结 4 843
無奈伤痛
無奈伤痛 2020-12-09 01:31

What\'s the code to subscribe to an event like applicationWillResignActive in any place in your iphone application?

[UPDATE]

Let me rephrase my question. I

4条回答
  •  星月不相逢
    2020-12-09 02:14

    Implement the method below in your application delegate:

    -(void)applicationWillResignActive:(UIApplication *)application
    

    This allows you to react when the application becomes inactive - when this is the case, it is executing but not dispatching incoming events. This happens, for example, when an overlay window pops up or when the device is locked.

    Just before it becomes inactive, the application also posts a UIApplicationWillResignActiveNotification.

提交回复
热议问题