cancel-button

How to enable cancel button with UISearchBar?

烂漫一生 提交于 2019-11-27 05:14:19
问题 In the contacts app on the iPhone if you enter a search term, then tap the "Search" button, the keyboard is hidden, BUT the cancel button is still enabled. In my app the cancel button gets disabled when I call resignFirstResponder. Anyone know how to hide the keyboard while maintaining the cancel button in an enabled state? I use the following code: - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [searchBar resignFirstResponder]; } The keyboard slides out of view, but the

UISearchBar disable auto disable of cancel button

血红的双手。 提交于 2019-11-27 01:14:20
问题 I have implemented a UISearchBar into a table view and almost everything is working except one small thing: When I enter text and then press the search button on the keyboard, the keyboard goes away, the search results are the only items shown in the table, the text stays in the UISearchBar, but the cancel button gets disabled. I have been trying to get my list as close to the functionality of the Apple contacts app and when you press search in that app, it doesn't disable the cancel button.