3

Possible Duplicate:
How to tell when back button is pressed in a UINavigationControllerStack

When I press the back button, what Delegate method is called?

peterh
  • 11,875
  • 18
  • 85
  • 108
Carlos Vargas
  • 254
  • 6
  • 18

2 Answers2

6

UINavigationBarDelegate is the delegate class and it implements -navigationBar:shouldPopItem, since these controllers work in stacks you're just pushing or popping views. This will most likely always evaluate to true otherwise I feel a back button that does anything but pop a view controller will violate Apple's Human Interface Guidelines.

Convolution
  • 2,351
  • 17
  • 24
  • This would not work for this specific question because the UINavigationController is involved. In this case I get a runtime error. – ruralcoder Mar 13 '12 at 00:20
0

I agree with elsurudo, the - (void)viewWillDisappear also gets called when you go to a third ViewController, but maybe you want your connection to exist in the Third View Controller but not in the First View Controller. So you might want to detect when the user goes back from the Second View Controller so you can disconnect properly.

Mark
  • 469
  • 1
  • 7
  • 10