Set helper gray text for UISearchBar

How can I set the default text in the search bar that looks gray so that it can hint at what you might be looking for before the user touches the search bar so that he can write something?

For example, I could “search for cafes or restaurants,” and when I touch UISearchBar, the text disappears?

+5
source share
1 answer

Try the Placeholder UISearchBar ... property and set it as Search for coffee shops or restaurants

Happy coding.

+18
source

All Articles