Implement backBarButtonItem to send message to delegate before

inside NavigationController. I want to reimplement the back button in the second level contentviewview controller to call an additional method before it returns to the first level content table controller. In this method, I want to send a message to a self-implemented delegate to inform the first-level content view controller of the changes made to the seconds-level content view controller. After that I want to set up my view controller normally.

In the didSelectRowAtIndexPath of my first level controller, I have 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 on the second level shows "test" -text, but didPressBack: in secondController is not called.

Or is there a different approach to re-implementing the Back button on a second-level controller?

+3
delegates uinavigationcontroller backbarbuttonitem


source to share


No one has answered this question yet

Check out similar questions:

661
How do I create delegates in Objective-C?
ten
How can I add a button to the right side of navigationController after clicking another view controller?
6
"UINavigationController back" button works in iPad landscape orientation
1
why does the appearance of a UINavigationController nested within a UISplitViewController animate the whole splitView?
1
navigationItem backBarButtonItem title
0
iOS - Reload UITableView with UINavigationBar feedback button without popup
0
TableView is title locked
0
UIViewController in UINavigationController not calling delegate method
0
Invalid argument exception - navbar, tab bar, UIView
0
iPhone navigationController not showing



All Articles
Loading...
X
Show
Funny
Dev
Pics