Wonky Navigation Bar Hiding Animation from a Split View Context

Number:rdar://45174428 Date Originated:11/10/18
Status:Open Resolved:
Product:UIKit Product Version:iOS 12
Classification:UI Reproducible:yes

UINavigationController has a special animation for hiding the navigation bar when it is done in viewWillAppear.  This should slide the navigation bar horizontally. Unfortunately when this is done from a view controller that is embedded in a split view's navigation controller the special animation is not here and the navigation bar shrinks vertically. This is a problem for a few reasons

- It can expose content beneath the navigation bar which isn't meant to be seen (eg. the background color of a split view)
- The interactivity of the animation is lost when using the interactive back gesture
- It just looks a bit strange and inconsistent.

Steps to Reproduce:

Check out the sample app here:


To see the proper animation:
Selecting "Show in NavigationController" then select "push"

To see the wonky animation
Selecting "Show in Split View" then select "push"

Expected Results:

There is the proper navigation bar hiding animation on pushing in a split view context

Actual Results:

The animation is wonky and the navigation bar slides up


iOS 12.0 at least



This issue appears to be related to UISplitViewController's habit of collapsing into a compact horizontal size class by embedding a navigation controller inside another navigation controller. I was able to work around this in my project by becoming the split view controller's delegate and flattening the navigation stacks like so :

public func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool { let primaryNav = primaryViewController as! UINavigationController let secondaryNav = secondaryViewController as! UINavigationController
primaryNav.setViewControllers(primaryNav.viewControllers + secondaryNav.viewControllers, animated: false) // return true to indicate we don't want UIKit to manage this collapsing return true }

By chris.hawkins at Jan. 30, 2019, 12:03 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!