Frage

How can I detect when a user exits the application? (hitting the home button) And how can I detect when the relaunch it? (clicking the icon)

*I'm not talking about users manually quitting the app by holding the home button and then making the icons wiggle and deleting the app instance from the sub-dock. i'm talking about just temporarily exiting the app buy clicking the home button.. maybe sending a text or whatnot then coming back to the app.

Thanks!

War es hilfreich?

Lösung

- (void)applicationDidEnterBackground:(UIApplication *)application

and

- (void)applicationDidBecomeActive:(UIApplication *)application

In your AppDelegate.m

- (void)applicationWillTerminate:(UIApplication *)application

Andere Tipps

There's a notification UIApplicationDidGoToBackground that fires when the home button is pressed. A similar notification tells you about going back to foreground.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top