iPad OS 18 UINavigationBar display incorrectly

I found iPadOS18 displayed navigation bar incorrectly when transition from screen with hidden navigation bar to screen that show navigation bar.

I have 2 ViewController: FirstViewController and SecondViewController.

  • FirstViewController navigationBar set isHidden to be true (hidden) and
  • SecondViewController navigationBar set isHidden to be false (showing).

When transition from FirstViewController to SecondViewController, the navigation bar is displayed incorrectly as shown in picture below:

Actual

Expected

Note I set hide navigation bar in viewWillAppear() in both ViewController

override func viewWillAppear(_ animated: Bool) {
  navigationController?.setNavigationBarHidden(..., animated: true)
}

source code: https://github.com/ornthita/TestTabbar

We've had the same issue. I found two ways of fixing it.

First is to unhide the bar in viewDidAppear - works, but feels janky as the user will see the bar appear after the push transition.

Second was hacky, but produces a cleaner experience for the user.

navigationController?.setNavigationBarHidden(false, animated: false)
RunLoop.main.perform {
  self.navigationController?.pushViewController(someController, animated: true)
}

We'll go with the first even though the layout jank makes it less nice for the user; queing up a push on the next run loop feels pretty horrible...

Hopefully Apple get round to fixing this pretty quickly, since they've forced this tab bar change on us!

iPad OS 18 UINavigationBar display incorrectly
 
 
Q