navigation will terminate?
does anyone know how 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 开发者_如何学JAVAview.
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.
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.
}
}
精彩评论