0

I have an app that utilizes a UINavigation controller in a storyboard to go through two UITableViews to get to the details view. I want to skip the second Table View and go straight to the Detail View. When the user taps 'back', they should see the Second Table View.

If I use

    [self.navigationController pushViewController:secView animated:NO];
    [self.navigationController pushViewController:thirdView animated:YES];

the app bugs out and I get

nested push animation can result in corrupted navigation bar
2012-06-11 15:02:23.695 App[3853:f803] Finishing up a navigation transition in an      unexpected state. Navigation Bar subview tree might get corrupted.

I have tried

    [self navigationController].viewControllers = [NSArray arrayWithObjects: dest, detView, nil];
    [[self navigationController] popToViewController:detView animated:YES];

This one worked okay, but I could not get back to the First View. The back button is gone.

I would like a few pointers, please.

anijam
  • 351
  • 1
  • 4
  • 13
  • 2
    Check this answer:http://stackoverflow.com/questions/5525519/iphone-uinavigation-issue-nested-push-animation-can-result-in-corrupted-naviga – self Jun 11 '12 at 19:37

1 Answers1

1

OK, after thinking about this, I came up with a different answer:

NSMutableArray *viewControllers = [self.navigationController.viewControllers mutableCopy];
[viewControllers addObject:secView];
[viewControllers addObject:thirdView];
[self.navigationController setViewControllers:viewControllers animated:YES];
[viewControllers release];
Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • This just gives the same error of Pushing the same view controller instance more than once is not supported – anijam Jun 11 '12 at 23:29
  • Sorry about that, my view worked a little different: I wasn't using animation. I posted a much better answer. I think this is the intended way making complex changes to the view controller stack. – Jeffery Thomas Jun 12 '12 at 12:25
  • What I ended up having to do was move the segue to point directly to the thirdView, then I added (only) the secondView to the viewControllers as above. Works now. Thank you! – anijam Jun 12 '12 at 17:10