I\'m trying to implement a simple search bar using Apple\'s latest UISearchController. However I can\'t seem to get it to work correctly if I use the search bar
Update for swift 3:
searchController.searchBar.showsScopeBar = false
Update for swift 4:
It seems that in swift 4 and ios 11 the search bar got changed. With the method showed above the scope bar will be inside the search bar in some cases.
if #available(iOS 11.0, *) {
navigationItem.searchController = searchController
navigationItem.hidesSearchBarWhenScrolling = false
} else {
tableView.tableHeaderView = searchController.searchBar
}
This fixed it for me. I use the the form shown above if ios 10 is available. If ios 11 is available i change my technic and set the navigation view controller to the search controller. You will notice it looks exactly as on ios 10