IOS - how to make default Back button invoke unind segue

Is it possible for the default back button to unwind the conversation? I know that this is possible with a standard button by dragging it to the green exit icon, but the back button does not appear on the storyboard by default.

This seems to be an example of the iPhone Contacts app. After you add a new contact, you will be taken to a screen displaying all the entered information, here '<The "Back" button will appear to perform unwinding on the contact list screen. Does anyone know how to do this?

I understand that I can add a standard button and make it cause segue to unwind, but it does not have the '<' that I would like to have.

+4
source share
1 answer

As I know, there is no way to set another action for the default back button. I spent a lot of time trying to do this. You can create a custom button that looks like the default, but the default button can be changed in the next version of iOS. To undo an action, you can simply edit the array of viewControllersyour navigation controller. For example, you have 4 view controllers in the stack of your navigation controller, and you want to return from 4th to 2nd. Paste this into the viewDidLoad:4th controller method :

NSMutableArray *viewControllers = [self.navigationController.viewControllers mutableCopy];
[viewControllers removeObjectAtIndex:2];
self.navigationController.viewControllers = viewControllers;
0
source

Source: https://habr.com/ru/post/1537850/


All Articles