PDA

View Full Version : UIApplication delegates not working in class




bignumbers
Jul 15, 2008, 05:21 PM
I'm sure this is a newbie question.

I have most of my code in my main view controller. Works fine.

I'd like to be told when the app is launching, or when the iPhone is going to sleep.

I can add this:
- (void)applicationWillTerminate:(UIApplication *)application
to my AppDelegate class, and that's fine. But my AppDelegate doesn't know the objects I want to deal with at shutdown.

But I'd like to add it to my view controller class. If I type it in, it says it doesn't know what applicationWillTerminate means.

Alternatively, I can catch it in the AppDelegate class, then call a instance method in my ViewController class. But I don't know how to do that either.

So, some newbie help would be appreciated! Thank you!



bignumbers
Jul 15, 2008, 06:08 PM
Whoops, never mind on this one too - figured that out.

UtilityAppDelegate gets the notification. It sends a message to RootViewController, when then sends it off to MainViewController. Zowie!

bessho
Apr 22, 2009, 12:46 AM
I run into the same problem. Could you explain how you get it to work? in utility view? what are the key steps?