I am setting up searchController as below in viewDidLoad() in my view controllers. One VC has table view embedded and another is UITableViewController.
I am using another VC to allow user to select a value and use that to filter tables items using unwind segue.
self.searchController.obscuresBackgroundDuringPresentation = false
self.searchController.hidesNavigationBarDuringPresentation = true
if #available(iOS 11.0, *) {
self.searchController.searchBar.delegate = self
self.navigationItem.searchController = self.searchController
self.navigationController?.navigationBar.prefersLargeTitles = true
self.searchController.searchBar.scopeButtonTitles = ["All", "<= 2", "<= 5", "<= 10"]
self.navigationItem.hidesSearchBarWhenScrolling = true
}
i do the below in unwind method.
DispatchQueue.main.async {
self.searchController.searchBar.text = searchText
let scope = self.searchController.searchBar.scopeButtonTitles![self.searchController.searchBar.selectedScopeButtonIndex]
self.filterContentForSearchText(searchText, scope: scope)
}
When table with data is loaded, search bar is hidden completely under navigation bar but when i assign value to the searchtext field that doesnt yield any items from data source, the search field clear icon shows as below.
I am using DZNEmptyDataSet framework to handle empty views. Earlier i had configured search bar from IB and at that below issue didnt come. Was using DZNEmptyDataSet at that time also.
What could be the issue?
Xcode 9.3 Testing in 11.3 simulator and 8 Plus.
Thanks Ashish