开发iphone应用程序时遇到一个问题。我想知道应用程序是否从后台重新打开,我怎么才能意识到这个状态?
这意味着:我打开我的应用程序,做一些业务逻辑。然后,按“主页”按钮将当前应用程序设置为后台状态。之后,我双击“主页”按钮查看在后台运行的应用程序。然后我选择我的应用程序再次重新打开它。我怎么知道应用程序从后台状态重新打开?
谢谢
答案 0 :(得分:3)
使用NSNotificationCenter注册UIApplicationWillEnterForegroundNotification。
答案 1 :(得分:1)
- (void)applicationWillEnterForeground:(UIApplication *)application {
/*
Called as part of transition from the background to the active state: here you can undo many of the changes made on entering the background.
*/
}