2010-08-01 91 views
0

没有人知道我可以调用类似的通知导航将终止?

- (void)applicationWillTerminate:(NSNotification *)notification 

这是当应用程序终止,但我要的是,当我钻了一个导航视图。

回答

1

我相信这里最简单的方法是执行UINavigationControllerDelegate,设置你的类为代表您的UINavigationController,并使用

-(void)navigationController:willShowViewController:animated: 

跟踪更改。你必须编写一些逻辑来确定你是否刚刚导航或关闭。

+0

你好,能告诉我一些例子吗? – Stefan 2010-08-02 14:38:34

0

例如,在您的代理...

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