进入后台:
- (void)applicationWillResignActive:(UIApplication*)application
- (void)applicationDidEnterBackground:(UIApplication*)application
进入前台:
- (void)applicationWillEnterForeground:(UIApplication*)application
- (void)applicationDidBecomeActive:(UIApplication*)application
前后台切换,主要的坑点在于:VC中并没有函数调用,尤其注意: - (void)viewWillAppear:(BOOL)animated 和 - (void)viewWillDisappear:(BOOL)animated 函数并不会被调用。想在VC中监听切换,只能监听通知,每个在appdelegate的生命代理方法都有相对应的通知。
网友评论