I make a tower call like this:

- (void)showViewWithSegueIdentifier:(NSString *)segueIdentifier { [self.navigationController.navigationController.topViewController performSegueWithIdentifier:segueIdentifier sender:self]; } 

I tried to catch it like this, but it didn’t work, because export comes from another controller:

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { NSLog(@"Call"); } 

How can this be fixed?

What it looks like:
I have a NavigationController> MainViewController, which has a Container View. Container View can> NavigationController> MenuViewController. Inside this container View, I inserted a Menu with buttons that open a new view.

  • @mike, If you are given a comprehensive answer, mark it as correct (click on the check mark next to the selected answer). - Nicolas Chabanovsky
  • What is the problem to catch in MainViewController? - Maxim Bogdanov

1 answer 1

If that UIViewController, from which the segue does not have to do anything with the destinationViewController, why not abandon this paradigm and designate the UIViewController that needs to show storyboardID and do something like:

 MYViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier: @"NeedeVC_ID"]; // здесь настраиваем то, что хотели настроить в prepareForSegue:, а дальше [self.navigationController.navigationController pushViewController:vc animated: true]; // как вариант еще можно сделать [self.navigationController.navigationController setViewControllers: @[vc] animated: true];