开发者

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.
}
}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜