iOS: Detecting when the multitasking bar has been opened
I'd like to be able to detect when the multitasking bar is in use (double-clicking the home button). Is this开发者_如何学Go possible?
NOTE: I'm not asking about detecting when the app is switched to the background, but just when the bar pops up, for instance to control the orientation lock or iPod controls.
From the Apple documentation for applicationWillResignActive:
This method is called to let your application know that it is about to move from the 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. An application in the inactive state continues to run but does not dispatch incoming events to responders.
This method is called when the user double-clicks the home button. That would probably be a good place to pause the game.
You could possibly try setting a KVC observer around the Window for the app.. I don't think the size changes, it looks like the Y origin might shift up.
Not sure what you are planning to do in that case though.
精彩评论