Mike Keskinov Mike Keskinov - 14 days ago 8
iOS Question

UISearchBar select all text

Is there any way to select all text in UISearchBar?
I tried [searchBar selectALL:], but it throw the signal (unrecognized selector).

I want to allow user to alter previous search text. At the some time, when user just starts typing new request, the old one should be dismissed. The standard way how to achieve it - select all text at the moment when text begin editing.

Answer

Here is another suggestion: when someone activates the search bar, there are two possible intentions: type new text or add to the existing text. I think you should give your user the choice.

If he wants to add text he naturally taps again at the end of the existing text.

If he wants to start over, he can press the clear button that automatically appears when the search bar becomes active.

Comments