Is it possible to somehow track the folding and opening of the application? I am writing a player, I would like it to stop when the application is minimized, and when I open it, I start playing
1 answer
In UIApplicationDelegate : there are methods that are called in appropriate situations:
applicationWillResignActive: - called when the application is minimized
applicationWillEnterForeground: - called when the application becomes active
Or there are system notifications:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillTerminate:) name:UIApplicationWillTerminateNotification object:nil]; |