I`m preparing app for iOS 13, and get bug with search controller in navigation bar. How to solve navigation bar glitch?
let search = UISearchController(searchResultsController: nil)
search.dimsBackgroundDuringPresentation = false
search.searchResultsUpdater = self
search.hidesNavigationBarDuringPresentation = false
self.definesPresentationContext = true
search.searchBar.isTranslucent = false
self.navigationItem.searchController = search
self.navigationItem.hidesSearchBarWhenScrolling = true
Press Cancel and navigation bar items becomes untouchable. Pushing view controller leads to navigation bar item overlap.
I have created test project on git https://github.com/eKroman/TESTsearchBar
Bug appears on iOS 13 beta (tested on iPad) using from Xcode 11 from beta 7 (maybe older beta) to Xcode 11 GM seed 2. Does not appear on simulators.
I encountered the same problem, if I cancel the searchBar and change the navigationItem.title then I have a double title 👍. It's like a ghost layer of the navigation bar stays here in the navigation controller.
This is how I fixed it:
searchController.hidesNavigationBarDuringPresentation = true
Probably best to use it until Apple fix this issue.
I also noticed that the back button switch to default color (blue), as if the navigationBar TintColor was reset.
Config: - Xcode 11.0 (11A420a) - iOS 13.1 (17A5844a)