I am using this code with no problem, but I would like to place the search controller below the navigation item’s titleView, instead of replacing it. With iOS11 it’s as easy as setting navigationItem.searchController to the searchController, and it will place it below the titleView, but in the navigationItem.
Any ideas on how to do this prior to iOS 11, instead of replacing the titleView?
Current Code:
if #available(iOS 11, *) {
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
} else {
navigationItem.titleView = searchController.searchBar
}
I don't know if it's still relevant for you, but for anyone searching an answer and ending up here, this is a way to do it:
if #available(iOS 11.0, *) {
navigationItem.searchController = searchController
} else {
tableView.tableHeaderView = searchController.searchBar
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With