title: How do you keep the cancel button in the search bar enabled when the keyboard is dismissed?
body: <p><img src="https://i.stack.imgur.com/P0cjS.png" alt="enter image description here"> <img src="https://i.stack.imgur.com/lqzMi.png" alt="enter image description here"></p>
  
  <p>I'm trying to achieve the same effect as Apple's Contacts app (left screenshot). The cancel button in UISearchBar is enabled even when the keyboard is dismissed. My app behaves differently (right screenshot). The cancel button automatically becomes disabled when the keyboard is dismissed. The user is forced to tap the cancel button one time to enable it and then another time to actually trigger the dismissal. This is not good user experience. How would I always keep the cancel button enabled like Apple's Contacts app?</p>
  
  <p><strong>Technical Details:</strong></p>
  
  <p>I'm not using <code>UISearchDisplayController</code> due to some design requirements. This is just a <code>UISearchBar</code> with my own custom search controller. The cancel button is shown using <code>[self.searchBar showsCancelButton:YES animated:YES]</code>. The keyboard is dismissed using <code>[self.searchBar resignFirstResponder]</code>. </p>