简体   繁体   中英

Is It possible to segue to a specific view controller from another storyboard

Within my app i have 2 storyboards, one has all the configuration screens and the other has the main screens of the app.

In one of the main screens of the app the user can press a button which allows them to go back and edit or add anything to the configuration.

The issue is if the user came from the main screens, once they press the done button on the configuration screen to confirm their changes, is there a way i can segue back to the main screen storyboard and then segue to the screen they were previously on before going to configuration ?

You need to have code to transition between the storyboards.

- (IBAction)showNextStoryboard:(id)sender
{
    UIStoryboard *nextStoryboard = [UIStoryboard storyboardWithName:@"SecondStoryboard" bundle:nil];
    UIViewController *nextRoot = [nextStoryboard instantiateInitialViewController];
    [self presentViewController:nextRoot
                       animated:YES
                     completion:^{}];
}

And to return:

- (IBAction)returnToPreviousStoryboard 
{
    [self.presentingViewController dismissViewControllerAnimated:YES completion:^{}];
}

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