Possible Duplicate:
How to tell when back button is pressed in a UINavigationControllerStack
When I press the back button, wha开发者_开发技巧t Delegate method is called?
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.
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.
精彩评论