1

My storyboard structure is like: enter image description here

A is a navigation controller B is a tab bar controller C,D,E are view controllers F,G,H,I,J are a view controllers

if now i am on I ,and there's a button the i pressed then I go back to C.How to do that? I tried make segue between I and C, but C has a back button, you pressed it,you back to I. I don't want that.when i came from I to C, i want C is as I first come to C from B.

if i want to go to H from I,I want H have a back button that you pressed and you back to F not to I.

leizh007
  • 71
  • 1
  • 7
  • if you want custom transition of views. its better to perform segues through programatically than connecting them modally.. – Avis Oct 10 '14 at 16:08
  • you can follow this question http://stackoverflow.com/questions/10003562/how-to-segue-back-to-a-uiviewcontroller-thats-already-loaded – Saad Chaudhry Oct 10 '14 at 16:16

3 Answers3

3

From I to C: do popViewController twice, or loop through the navigationcontroller's viewcontrollers and find C, pop to C.

From H to I: Programmatically push to I. In storyboard set an storyboard ID for I, and you can create a I instance through [storyboard instantiateViewControllerWithIdentifier:ID];

gabbler
  • 13,626
  • 4
  • 32
  • 44
0

I would set the viewControllers property of UINavigationController.

Create an array of View Controllers like you would desire the stack to be. Example: @{C, F, I} or in the case of your question you would use @{ C } then update the navigationController to contain these views.

[self.navigationController setViewControllers:(NSArray *)];
egarlock
  • 559
  • 3
  • 11
0

If you want to do something other than what your Segues are set up for, be sure to give your VC a stoyboard ID like this

Then using that storyboard ID, you can call this code to create/display;

-(IBAction)myButtonAction:(id)sender{
    RDLaunchOptionsTableViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"RDLaunchOptionsTableViewController"];
    vc.delegate = self;
    [self.navigationController pushViewController:vc animated:YES];
}

You don't have to use a nav controller. Just use [self presentViewController....];

VaporwareWolf
  • 10,143
  • 10
  • 54
  • 80