I got a navigation bar containing some UIBarButtonItem
buttons and a UISearchBar
hooked up like this
var searchController: UISearchController!
override func viewDidLoad() {
super.viewDidLoad()
title = "Test"
tableView.delegate = self
tableView.dataSource = self
searchController = UISearchController(searchResultsController: nil)
navigationItem.searchController = searchController
// This leads to the bug
searchController.hidesNavigationBarDuringPresentation = false
navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(leftTapped))
navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(rightTapped))
}
Scenario: I tap into the search bar and tap cancel afterwards.
Issue 1: The bar buttons are not reacting to touch except when I touch the outer most pixels of the screen (only possible with the simulator and mouse clicks).
Issue 2: The navigation items are overlapping when I push another view controller.
When I use hidesNavigationBarDuringPresentation = true
it's working like expected.
The issue appears on notched and non-notched iPhones iOS 13.0 and 13.1 using Xcode 11.0 and 11.1.
Here's the whole test project: https://github.com/fl034/HidesNavigationBarDuringPresentationTest
I've filed a radar (and you should too), but maybe some of you guys have already a workaround for it?
Update 1: Bug is still there in iOS 13.1.1
Update 2: Bug is fixed in iOS 13.2 beta (thanks @Ben Gomm)
hidesNavigationBarDuringPresentation
true to avoid this bug, but that's not the appearance I want. I presume it is a bug. With large titles on, cancelling the search bar seems to make a second large title appear that doesn't scroll with the rest of the scroll view. – GindersearchController.hidesNavigationBarDuringPresentation = true
– Cavallaroxcode-select
command. You should archive with the same version you're developing to avoid surprises like this. – Cavallaro