I'm facing an issue - when UISearchBar is activated then inputAccessoryView gets hidden and doesn't show up even after de-activation of UISearchBar searching in iPad.
Please find the code in this repo - InputAccessoryView_Issue and feel free to commit your solution in the repo itself or here in Stackoverflow.
TIA
The solution that I found was to make the detail controller as first responder immediately after Searchbar ends editing. Below is the sample code for the same:
extension NSNotification.Name {
static let SearchbarEndEditing = NSNotification.Name("SEARCHBAR_END_EDITING")
}
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
NotificationCenter.default.post(name: .SearchbarEndEditing, object: nil)
}
And in DetailViewController:
override func viewDidLoad() {
super.viewDidLoad()
NotificationCenter.default.addObserver(self,
selector: #selector(handleSearchbarEndEditing),
name: .SearchbarEndEditing,
object: nil)
}
@objc private func handleSearchbarEndEditing(_ sender: NSNotification) {
becomeFirstResponder()
view.becomeFirstResponder()
}
It worked for me and hopefully, it works for everyone else as well!