Perform search only when enter is pressed for UISearchController

tng

I'm using UISearchController (not UISearchDisplayController) and I cannot figure out how to get the search to fire off only if the user hits enter in the text box. The UISearchResultsUpdating protocol only has a single method and it wasn't clear that any of the states there could be checked to accomplish the search only when enter is pressed.

Is this possible?

matt

If you don't want to do anything on each updateSearchResultsForSearchController call, don't do anything. Just set yourself as the search field's delegate (UISearchBarDelegate) and now you can respond "if the user hits enter in the text box" as the delegate (whatever it is you mean by that).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Cancel Instant Search when Enter is pressed

Submit a form only when 'enter' key is pressed

Run javascript function when enter is pressed - JavaScript only no Jquery

How to disable the <KeyRelease> event only when the enter key is pressed

html & javascript enter button redirects to error page - otherwise duplicates text to chat (only when enter is pressed)

Run method when enter is pressed

Run Javascript when enter pressed

UISearchController only update on search button click

How I make the search only work when I hit enter?

How do I deselect a text entry box/update it to read only when enter is pressed?

how to only change display when submit button is pressed and not when search is changed

How to make a UIBarButtonItem perform a function when pressed?

Perform search with filled textboxes only

Android remove focus of TextEdit when Enter is pressed

Disable input when enter is pressed dynamically

Submit a form when enter is pressed in a textarea in React?

Writing to a div from a form when enter is pressed

Odd RubyMine indenting when enter is pressed

Invoke a serie of actions when Enter key is pressed

Form not submitting when enter key is pressed

add characters when enter button pressed

Submit a certain button when ENTER is pressed

Stop entering values into array when enter is pressed

How to show alert when enter key pressed

Java Scanner not accepting input when enter pressed

Move + Submit Input when enter is pressed

Javascript to trigger submit when enter is pressed

When Enter is pressed Ok Button should be clicked

How to go to next textbox when enter is pressed?