具体实现:首先我们看看app进入后台进入前台的几个常用方法
#pragma mark - 程序将要进入后台(墓碑状态)
- (void)applicationWillResignActive:(UIApplication *)application {
}
#pragma mark - 程序进入后台
- (void)applicationDidEnterBackground:(UIApplication *)application {
}
#pragma mark - 程序将要进入前台
- (void)applicationWillEnterForeground:(UIApplication *)application {
}
#pragma mark - 程序进入前台
- (void)applicationDidBecomeActive:(UIApplication *)application {
}