简体   繁体   中英

How do I unwind a segue back?

I've looked through numerous answers and tried everything (it seems), but I still cannot get my unwind to work.

I have as a storyboard sequence:

Nav Controller -> Main Interface Controller -> Nav Controller -> City Selection Table View Controller.

I've added a bar button to function as a back button in my City Selection Table View Controller to go back to the Main Interface, and linked it to the exit, but it still is not working.

My CitySelectionTableViewController.m file

#import "CitySelectionTableViewController.h"

@interface CitySelectionTableViewController ()

@end

@implementation CitySelectionTableViewController
- (IBAction)unwindToMainInterfaceViewController:(UIStoryboardSegue *)segue
{
}
...

My storyboard is showing the "Unwind segue from Back to Exit" segue in the document outline, but nothing is happening. I can reach the city selection view, but "Back" will not bring me back. Any suggestions? I do realize this is a fairly common question, but I've tried many answers from StackOverflow and others with no success.

You shouldn't have two navigation controllers in your chain. You cannot go back from the CitySelectionTableViewController since it is already the first view controller of the navigation controller it's embedded in, and there's nowhere to go back to. You should have just one controller for one navigation stack:

Nav Controller -> Main Interface Controller -> City Selection Table View Controller

This way everything should work out of the box and you won't even have to manually add the Back button, it will be created automatically when you make the segue from the Main Interface Controller to the City Selection Table View Controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM