Skip to content

UISearchBar: showsSearchResultsButton property ​

The showsSearchResultsButton property indicates whether a results list button is shown at the right end of the text field.

Value ​

A boolean.

ValueEffect
trueA results list button is shown at the right end of the text field
falseNot shown
  • Readable and writable.
  • The default is false.
  • When the user taps the results list button, the search bar fires resultslistclick.
  • It is independent of showsBookmarkButton; both can be true at once. Which one is shown when both are on is not verified in the simulator.
  • Turning it off doesn't change isSearchResultsButtonSelected back to false.
  • Values of other types are converted to a boolean by truthiness.
  • There is no change event: only the app's own code changes it.

Examples ​

js
const search = new UISearchBar();
search.showsSearchResultsButton = true;
search.addEventListener('resultslistclick', () => console.log('show results list'));

Effect: A results list button appears at the right end of the text field. Tapping it prints show results list to the console. Not verified in the simulator.

Corresponding iOS API ​

UISearchBar.showsSearchResultsButton.

See also ​