【发布时间】:2011-02-23 08:34:50
【问题描述】:
我在开发 iphone 应用程序时遇到一个问题。我想知道应用程序是否从后台重新打开,我该如何实现该状态?
这意味着:我打开我的应用程序,执行一些业务逻辑。之后,我按“主页”按钮将当前应用程序置于后台状态。之后,我双击“主页”按钮以查看应用程序在后台运行。然后我选择我的应用程序再次重新打开它。我如何知道应用程序从后台状态重新打开?
谢谢
【问题讨论】:
标签: iphone cocoa-touch background
我在开发 iphone 应用程序时遇到一个问题。我想知道应用程序是否从后台重新打开,我该如何实现该状态?
这意味着:我打开我的应用程序,执行一些业务逻辑。之后,我按“主页”按钮将当前应用程序置于后台状态。之后,我双击“主页”按钮以查看应用程序在后台运行。然后我选择我的应用程序再次重新打开它。我如何知道应用程序从后台状态重新打开?
谢谢
【问题讨论】:
标签: iphone cocoa-touch background
使用 NSNotificationCenter 注册UIApplicationWillEnterForegroundNotification。
【讨论】:
- (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.
*/
}
【讨论】: