-1

I have a pop-up which has to be hidden when the user moves away from the class. On tapping on the home button, the doesn't happen.

- (void)applicationDidBecomeActive:(UIApplication *)application

- (void)applicationDidEnterBackground:(UIApplication *)application

Other than the above functions is there any other delegate functions which would be called in the same class (not the app-delegate class).

Ambili B Menon
  • 1,249
  • 2
  • 14
  • 26

1 Answers1

2

Only the UIApplicationDelegate defines those methods. If you want any other class to handle those events, you need to have the class register for the corresponding notification.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backgrounding) name:UIApplicationDidEnterBackgroundNotification object:nil];

And don't forget to remove the observer.

Then you need the method:

- (void)backgrounding {
    // App entered background
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579