How to react to applicationWillResignActive from anywhere?

前端 未结 4 837
無奈伤痛
無奈伤痛 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:24

    Your topic and question are asking slightly different things.

    Your application will receive applicationWillResignActive, along with applicationWillTerminate, automatically. No subscription is necessary, just implement the function in your app.

    As to how to respond, this is down to the application. While you can choose to do nothing the recommended behavior is that you cease or slow any non-critical functionality. E.g. if you were a game you would stop updating the display and/or pause the game.

提交回复
热议问题