0

I have hierarchy of ViewControllers in my storyboard structure. It is A-B-C-D. A is embed with NavigationController and the flow goes on till D viewController. All fours view attached through segues. Now I am on D viewController, I defined some action to the button of D that It should take me directly to A viewController that is rootViewController or B viewController. Then how can I achieve this. I tried everything but didn't succeed.

I want something like it should not disturb A-B-C-D flow and it should take me to A viewController from D.

Roland Keesom
  • 8,180
  • 5
  • 45
  • 52
iMash
  • 1,178
  • 1
  • 12
  • 33

1 Answers1

2

Right click on your D viewcontroller and drag i to your A viewcontroller.

Then click on the object which appears on the line you just created.

Write something like DtoA in the storyboard segue identifier in the attributes inspector.

Now in D view controller, just do:

[self performSegueWithIdentifier:@"DtoA" sender:self];

And if you instead wish to pop to a previous viewcontroller the old fashioned way, like from D to B:

UINavigationController* navController = self.navigationController;
UIViewController* Bviewcontroller = [navController.viewControllers objectAtIndex:1];
[navController popToViewController:controller animated:YES];

I hope this helps!

AlexanderN
  • 2,610
  • 1
  • 26
  • 42