UIApplicationDidBecomeActiveNotification通知在第一次运行应用程序时不会触发

时间:2013-06-29 00:55:01

标签: ios ios6 uiviewcontroller nsnotificationcenter

我在init方法和viewDidLoad方法中调用了这行代码。但是,方法applicationDidBecomeActiveNotification NEVER在我第一次运行应用程序时触发。它只在我运行一次后运行。

 [[NSNotificationCenter defaultCenter] addObserver:self
          selector:@selector(applicationDidBecomeActiveNotificationAction)
                           name:UIApplicationDidBecomeActiveNotification
                                               object:nil];

这是对的吗?有没有办法让我的viewController在第一次运行应用程序时收到UIApplicationDidBecomeActiveNotification的通知。

1 个答案:

答案 0 :(得分:1)

第一次运行APP时不会被触发

UIApplicationDidBecomeActiveNotification

Posted when the application becomes active.
An application is active when it is receiving events. An active application can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.

你可以在APP初始化后自己解雇。