inside a NavigationController I want to re-implement the back button in a second level content tableview controller to call an additional method before it pops back to the first level content tableview controller. In this method I want to send a message to a self implemented delegate to inform the first level content view controller about changes made in the seconds level content view controller. After that I wanna pop the view controller as normal.
In didSelectRowAtIndexPath of my first level controller I implemented:
SecondController *secondController = [[SecondController alloc] initWithNibName:@"Second" bundle:nil];
[secondController setDelegate:self];
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithTitle:@"test" style:UIBarButtonItemStyleDone target:secondController action:@selector(didPressBack:)];
[[self navigationItem] setBackBarButtonItem:button];
[(UINavigationController*) self.parentViewController pushViewController:secondController animated:YES];
[secondController release];
So, the back button in second level shows the "test"-text, but didPressBack: in secondController isn't called.
Or is there another approach to re-implement the back button in the second level controller?