views:

157

answers:

1

Is it possible to check when the back button is pressed in a UINavigationController stack? I've tried adding a action and target to self.navigationItem.backBarButtonItem to no avail.

Anyone have any solutions?

A: 

Make some object the delegate of the navigation controller's navigationBar and implement the -navigationBar:didPopItem: or -navigationBar:shouldPopItem: methods in the UINavigationBarDelegate protocol.

Noah Witherspoon
When using[self.navigationController.navigationBar setDelegate:self];I get a crash with the error: Cannot manually set the delegate on a UINavigationBar managed by a controller.
Don't do this if you are using a UINavigationController--you /only/ do this if you are implementing that kind of functionality yourself.
Jason Coco