1
votes

My app is based around a UINavigationController. On some screens I have a UITabBarController embedded within. When I go to a screen with the tab bar everything works fine on the first tab. (each tab is a UITableViewController) I can tap a cell of the table view and it'll take me to the next page by correctly pushing it onto my nav controller. If I go to another tab it loads the table view fine, but if I tap a cell to take me to another view I get this 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.

It pushes on the next page, but then if I attempt to press the back button on the nav bar the app will crash.

How could I go about fixing this? I looked at multiple other responses to similar problems, but none of them have helped me with this.

2
According to Apple's documentation, you shouldn't embed a tab bar controller in a navigation controller, so that design choice may not work. - rdelmar

2 Answers

1
votes

It would be really helpful if you share your code. However this may be helpful for you:

while using tab bar , you should try that every single tab has its own navigation controller and use individual navigation controller to move to specific viewcontrller of specific tab. I know its hard to understand like this..

For e.g in app del you have your main navigation controller using which you push to next view controller ,say "SecondViewController".

Now this second one has got one tab bar with 4 tabs tab1,tab2,tab3,tab4. now each tab can have any no of view controllers associated with them. For e.g on tab1,you move to another screen and again from there to next screen and so on.

So to manage them there should be separate navigation controllers like,tab1nav,tab2nav,tab3nav,tab4nav.

 tabBarController.viewControllers = [NSArray arrayWithObjects:"tab1nav".....and so on all nav, nil];

Now depending in which tab you are, use that tab's navigation controller to move to next screen of that tab or move back.

1
votes

If you have viewDidAppear function,

Remember to put [super viewDidAppear:animated]; inside the function.