views:

30

answers:

2

Hi,

does anyone knows how can i can call a notification similar to

- (void)applicationWillTerminate:(NSNotification *)notification 

which is when app terminate, but what i want is when i drill up a navigation view.

thks in advance.

+1  A: 

I believe the simplest approach here is to implement UINavigationControllerDelegate, set your class as the delegate for your UINavigationController, and use

-(void)navigationController:willShowViewController:animated: 

to track changes. You'll have to write some logic to figure out if you've just navigated up or down.

Seamus Campbell
Hi, can show me some examples?
Stefan
A: 

For example, in your delegate...

-(void)navigationController:(UINavigationController *)aController
willShowViewController:(UIViewController *)aViewController
animated:(BOOL)animated
{
if( [aViewController isKindOfClass:[MyCustomViewController class]])
{
//ive just popped or pushed the MyCustomViewController instance
//do something.
}
}

Warren Burton