My goal is to prevent the cancel button from appearing in a search bar in a UISearchController. I started with Apple\'s Table Search with UISearchController sample code and
For iOS 8, and UISearchController, use this delegate method from UISearchControllerDelegate:
UISearchControllerDelegate
func didPresentSearchController(searchController: UISearchController) { searchController.searchBar.showsCancelButton = false }
Don't forget to set yourself as the delegate: searchController.delegate = self
searchController.delegate = self