Saturday, 16 November 2019

Grey background in navigation bar with searchController added to navigationItem during push

I have a table view in navigation controller so that I can push the detail view controller on the stack. It works fine, until I add a search controller to the navigation item, like so:

searchController.obscuresBackgroundDuringPresentation = false
searchController.hidesNavigationBarDuringPresentation = false
searchController.searchBar.delegate = self
searchController.searchBar.tintColor = Colors.mlLabel
navigationItem.searchController = searchController
definesPresentationContext = true

It results in temporary grey background, see below:

enter image description here

When debugging the view hierarchy, it looks like UIViewControllerWrapperView's _UIParallaxDimmingView(selected below) is causing this, as both navigation bar and status bar are transparent.

enter image description here

How can I fix this?

Note: Setting the animated property in pushViewController() to false works, but I'd like to keep the animation.



from Grey background in navigation bar with searchController added to navigationItem during push

No comments:

Post a Comment