2

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

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

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

4

1 回答 1

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初始化后自己触发它。

于 2013-06-29T01:50:39.590 回答