i have three controller and i wanna kown the controller is a push or pop
A controller:
{
if(!b)
b = [B alloc] init];
[self.navigationController pushViewController:b animated:YES];
}
B controller:
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
//I want here to judge, from the "A" push over, or to return from the "C" "pop"
//if it is push from A
//dosomething.....
//if it is pop from C
//dosomething
}
-(void)testAction:(id)sender
{
C *c = [[C alloc] init];
[self.navigationController pushViewController:b animated:YES];
[c release];
}
C controller:
{
[self.navigationController popViewControllerAnimated:YES];
}
thanks.
EDIT :
Add UINavigationControllerDelegate in .h file
Also do this:
[self.yournavController setDelegate:self];
Method below is navigation controller delegate
which is called when the navigation controller shows
a new top view controller
via a push
, pop
or setting
of the view controller stack
.
Add this method
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
}