我在开发iphone应用程序时遇到了一个问题。我想知道如果应用程序从后台重新打开,我怎么能意识到这种状态?iphone:如何知道从后台打开的应用程序
这意味着:我打开我的应用程序,做一些业务逻辑。之后,我按下'Home'按钮将当前应用程序设置为背景状态。之后,我双击'Home'按钮来查看应用程序在后台运行。我选择我的应用程序重新打开它。我如何知道应用程序从后台状态重新打开?
谢谢
我在开发iphone应用程序时遇到了一个问题。我想知道如果应用程序从后台重新打开,我怎么能意识到这种状态?iphone:如何知道从后台打开的应用程序
这意味着:我打开我的应用程序,做一些业务逻辑。之后,我按下'Home'按钮将当前应用程序设置为背景状态。之后,我双击'Home'按钮来查看应用程序在后台运行。我选择我的应用程序重新打开它。我如何知道应用程序从后台状态重新打开?
谢谢
注册为UIApplicationWillEnterForegroundNotification使用NSNotificationCenter。
- (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.
*/
}
该方法在ApplicationDelegate中。我想用我目前的观点来了解它。 – haisergeant 2011-02-23 08:39:18
只要你从背景进入,这个代表就会打电话,而不管这些意见。 – KingofBliss 2011-02-23 08:43:51
你为什么要查看视图? – KingofBliss 2011-02-23 08:44:10
谢谢。你的回答对我很有帮助。 – haisergeant 2011-02-23 08:51:31
+1我完全忘记了NSNotificatioCenter – KingofBliss 2011-02-23 08:54:16