Using UISearchController to add filtering to a UITableView. The section header overlaps with the search bar on iOS 8 using Xcode 7. This looks good in iOS 9. What workaround can I get in place so iOS 8 looks like the iOS 9 version?
override func viewDidLoad() {
super.viewDidLoad()
self.searchController.searchResultsUpdater = self
self.searchController.hidesNavigationBarDuringPresentation = false
self.searchController.dimsBackgroundDuringPresentation = false
self.tableView.tableHeaderView = searchController.searchBar
self.definesPresentationContext = true
self.searchController.searchBar.sizeToFit()
tableView.sectionIndexBackgroundColor = UIColor.clearColor()
}
Made the change to be:
self.searchController.searchResultsUpdater = self
self.searchController.hidesNavigationBarDuringPresentation = false
self.searchController.dimsBackgroundDuringPresentation = false
self.searchController.definesPresentationContext = true
self.searchController.searchBar.sizeToFit()
self.navigationItem.titleView = self.searchController.searchBar;
tableView.sectionIndexBackgroundColor = UIColor.clearColor()
So setting the definesPresentationContext on the searchController, not the view controller.