New UINavigationBar appearance in detail pane of UISplitViewController in iOS 13 : <p>Under iOS 13, if you setup a scrollable root view controller (such as a UITableViewController) in a navigation controller and then put that navigation controller in the detail pane of a UISplitViewController, then the nav bar's background isn't visible when the scrollable content is at the top.</p>

<p>You can see this by creating a new iOS project based on the Master/Detail template. Then modify the storyboard to use a UITableViewController inside the detail pane's nav controller. Put the device/simulator in Light Appearance mode (it shows the problem better than Dark mode). Run the app and notice the nav bar area is the same color as the table view background. Now scroll the table view up and the nav bar color changes to the standard light gray. Let the table view return to the top and the nav bar color disappears again.</p>

<p>I've only seen this in the detail pane of a split view controller.</p>

<p>How do you turn off this "feature" so that the nav bar looks normal just like every other nav bar used anywhere else other than the detail pane of a split view controller?</p>

<p>There are no relevant API changes for <code>UISplitViewController</code> or <code>UISplitViewControllerDelegate</code>. There's nothing in <code>UINavigationController</code> either.</p>

<p>After some digging I found one workaround but I'd love to find a way to avoid having to do this.</p>

<p>The <code>UINavigationBar</code> class now has some new properties for setting its appearance. Oddly, none of these are mentioned under the "Customizing the Appearance of a Navigation Bar" in the documentation for <code>UINavigationBar</code>.</p>

<p>There are three new properties in iOS 13:</p>

<ul>
<li><code>standardAppearance</code></li>
<li><code>compactAppearance</code></li>
<li><code>scrollEdgeAppearance</code></li>
</ul>

<p>All three are of type <code>UINavigationBarAppearance</code>.</p>

<p>Only the first one is set by default.</p>

<p>Even though <code>scrollEdgeAppearance</code> is <code>nil</code>, the detail pane of a split controller acts as if this has been set with the <code>backgroundColor</code> set to the <code>clear</code> color.</p>

<p>So the workaround is to add the following line to the <code>viewDidLoad</code> method of the navigation controller's root view controller:</p>

<pre><code>navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
</code></pre>

<p>Why is this needed only in this one case? Is there a more correct solution other than adding this code?</p>

<p>I noticed that none of Apple's apps (Mail, Notes, and Files at least) seem to use this "feature".</p>
