I’m building a game for iOS using Cocos2D. In my game I have a pause menu that can be pulled up when playing the game. A simple tap will return from the pause menu to the game. What I would like to implement is a clean way to resume the game on the pause menu if the method applicationDidBecomeActive is called. The problem is that only the appDelegate receives the call to applicationDidBecomeActive, and my pause menu is many layers deeper than that. Right now I’m essentially passing the applicationDidBecomeActive call through about 4 different layers to get it down to the pause menu. There must be a cleaner way?
I’m building a game for iOS using Cocos2D. In my game I have a
Share
Sure is. Just add an observer for the
UIApplicationDidBecomeActiveNotificationfrom anywhere that’s convenient. Application state changes can be hooked that way as well as via the app’s delegate.(Docs here.)