Hey guys when I press the back button, what Delegate method is called? Best Regards Carlos Vargas
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.
Also, if you properly push items on the stack then you never have to manually deal with the back button logic. If it does not work then you are doing something wrong. If you need to know when the user goes back and execute some code then you are doing it in the wrong place.
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.