Possible Duplicate:
Can I watch an NSNotification from another class?
I am currently using this code below in my appDelegate.m file:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleEnteredBackground:)
name: UIApplicationDidEnterBackgroundNotification
object: nil];
}
However, I want it to call a selector in my viewController.m file. How can I do this?
Thanks!
Generally, you register the notification first, in your viewController.m
initmethod (or somewhere else appropriate):In your App Delegate, fire the notification: