iOS14 missing TabBar on popping multiple ViewControllers

Seems like there is a confirmed bug on Xcode12 + iOS14.

I have a UINavigationController on each item of a UITabBar, and I've set hidesBottomBarWhenPushed to YES on every secondary ViewControllers, so the TabBar will only be shown on the rootViewController of navigationController. But when I try popping multiple ViewControllers, like pop C from stacks like A-B-C, I found that the TabBar just missing on A.

Also another weird part, when I print navigationController.viewControllers in viewWillDisappear: method on C, I found it printing like "C-A". How C moved to the top of the array??

This is confirmed on a simple demo app, wonder when it will be fixed.

Accepted Reply

Same problem to me

You can re-write UINavigationController push function

Code Block
// fix: sometimes push and then popback no tabbar error
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
  if (self.viewControllers.count == 1) {
    viewController.hidesBottomBarWhenPushed = YES;
  } else {
    viewController.hidesBottomBarWhenPushed = NO;
  }
  [super pushViewController:viewController animated:animated];
}

Replies

We had the same problem with Xcode 12 and iOS 14.0 & 14.1 but it looks like it's been resolved on iOS 14.2.

Could anyone confirm that?

Thanks for the workaround tho!
@francoisfromnyc I am also seeing this fixed in Xcode 12 + iOS 14.2!
I have meet a similar problem. After call popToRootViewControllerAnimated: , then call pushViewController: method which had set hidesBottomBarWhenPushed = YES, but the tabbar still shows.
I fixed it by rewrite popToRootViewControllerAnimated: method, and add thd following code:
Code Block
- (NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
  NSInteger currentTab = (NSInteger)self.tabBarController.selectedIndex;
  self.tabBarController.selectedIndex = labs(currentTab - 1);
  self.tabBarController.selectedIndex = currentTab;
  return [super popToRootViewControllerAnimated:animated];
}