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
I think there are three ways of achieving that:
searchController.searchBar.showsCancelButton = false
Subclass UISearchBar and override the layoutSubviews to change that var when the system attempts to draw it.
Register for keyboard notification UIKeyboardWillShowNotification and apply the code in point 1.
Of course can always implement your search bar.