When we click back button in navigation controller, it'll automatically pops the view controller and goes back to the previous view controller.. could anyone tell me how it's works.. where is the code for that action in xcode.
preguntado el 02 de febrero de 12 a las 11:02
The code which does all of that is handled in Apple's
UINavigationController class. You don't get to see this code.
If you want to change the behavior of Apple's classes they sometimes delegate responsibility for some of the actions they perform, or sometimes just provide information that something is going to happen.
For example if your class becomes the delegate of UINavigationController it will send you two messages:
– navigationController:willShowViewController:animated: – navigationController:didShowViewController:animated:
I dont know what you exactly mean by "how it works"..but what happens is the view controllers are placed in a stack (RootController which is the Navigation controller) and when you press "back" button it simply pops the top most controller in the stack and you are back from where you came.Hope it helps..!!
Are you looking this?