例如,在iOS Mail中,无论我打开和关闭它的频率如何,当显示屏幕时,应用始终似乎都会刷新。
我正在尝试通过viewWillAppear
复制功能。但是我在测试期间注意到的一件事是,在运行应用程序时并不总是调用viewWillAppear
,但是当从子视图返回时它总是被调用。因此,当它打开时,它可能会刷新,也可能不会刷新,这可能很烦人。
我可以使用其他事件和/或对象吗?
答案 0 :(得分:2)
您的AppDelegate中应该有方法applicationWillEnterForeground:
。每次应用程序返回前台时都会调用此方法
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
答案 1 :(得分:2)
深入了解显示应用生命周期的下图。