In a UINavigationController-based iPhone app, in a method I would like to perform the programmatic equivalent of the back button being pressed and going back a view.
i.e. automatically press the Jobs button as seen here:
Is there a generic iOS call I can make, or is more information required?
Back-button text is taken from parent view-controller's navigation item title. So whatever you set on previous view-controller's navigation item title, will be shown on current view controller's back button text. You can just put "" as navigation item title in parent view-controller's viewWillAppear method.
UINavigationController
's -popViewControllerAnimated:
method should do what you want:
[navigationController popViewControllerAnimated:YES];
Assuming you don't actually want to PRESS the button programmatically, but simply copy the outcome of pressing the button, you should tell the navigation controller to pop the current view controller.
[self.navigationController popViewControllerAnimated:YES];
This will remove it from the stack, and return you to the previous view controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With