Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

bignumbers

macrumors regular
Original poster
May 9, 2002
206
0
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

macrumors regular
Original poster
May 9, 2002
206
0
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

macrumors newbie
Apr 21, 2009
1
0
help

I run into the same problem. Could you explain how you get it to work? in utility view? what are the key steps?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.