iPhone – Programmatically call navigation controller back button | root view

We can call navigation controller back button programmatically from any button click or any where in the screen. There is very simple code to go back in previous i-Phone screen.

[self.navigationController popViewControllerAnimated:YES];

If you want to go in parent (root / main) screen. For example your first screen is ‘A’ and then you go to screen ‘B’ and then ‘C’

A -> B -> C

And now you directly want to go back from C to A programmatically then write following code in your button click or any where in code. In above example ‘A’ is root view.

[self.navigationController popToRootViewControllerAnimated:YES];

 

Leave a comment

Your email address will not be published. Required fields are marked *