Ios – nested push animation can result in corrupted navigation bar

iosipadiphoneobjective c

in one of my viewcontroller, lets say A, I have the following:

 OnbViewController *on = [[OnbViewController alloc] initWithNibName:nibName bundle:nil];
        onboardingTutorial.delegate_ = self;
self.test = on
 UINavigationController *nController = [[UINavigationController alloc] initWithRootViewController:self.test]
[self presentModalViewController:nController]
[nController release];

then inside OnbViewController I have pushed to the navigationController:

[self.navigationController pushViewController:someViewController];

then in didSelectRowForIndexPath: I called a delegate, which is A, inside the delegate function I called I tried to push again by doing:

[self.test pushViewController:someOtherViewController];

and then this gives me that error:

nested push animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
   Unbalanced calls to begin/end appearance transitions for <someOtherViewController: 0x6f942e0>.

any idea?

Best Answer

Rather convoluted calling sequence, but the first issue I see is that it looks like you're calling pushViewController on an OnbViewController, not on its navigationController. Maybe changing to [self.test.navigationController pushViewController:someOtherViewController]; will suffice?

Edit: in looking further at this, I note the "animation" in "nested push animation". Is onbViewController pushing to someViewController during its viewWillAppear or somewhere early like that? Maybe skipping the second animation will work?

Related Topic