1

我有一个视图,其中包含带有一些子视图(UIViewControllers)的滚动视图。我想在 applicationWillResignActive: App Delegate 的方法中从一个类(他们的 UIViewControllers 之一)调用一个方法(停止计时器)。

实现这一点的最佳方法是什么?

4

1 回答 1

4

不要担心在您的应用程序委托中处理该事件并将其传递。只需在您有兴趣处理事件的任何课程中注册通知:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(someMethod:)
                                             name:UIApplicationWillResignActiveNotification
                                           object:nil];
于 2012-08-02T17:33:43.543 回答