I have a UIViewController on a tab of a tab based app, that hooks up UIApplicationDelegate. I’d like to handle app events by UIApplicationDelegate, but I don’t get them in my UIViewController, its methods are not called.
What should I do beside hook up it in my UIViewController’s interface declaration?
@interface TestViewController : UIViewController<UIApplicationDelegate>
@end
Other delegates are works, I can handle them, except this, UIApplication and its delegate should have some trivial ‘trick’, but I could not find.
Thanks!
If you need a class other than the app delegate to respond to the various application events, then have the other class register for the various application notifications.
For example, to deal with the app entering the background:
See the docs for
UIApplicationfor a list of all of the notifications.Don’t forget to remove the observer in the
deallocmethod of the class.