Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set first text on UISearchBar

Tags:

i want to set first text on my UISearchBar -the text is "Search"-, and the text will disappear when user start typing. just like this:

alt textalt text

how it could be.??? thanx

like image 977
Imam Arief W Avatar asked Sep 06 '10 09:09

Imam Arief W


2 Answers

use placeholder property to set your grayish text that get disappears while text is written on it

searchBar.placeholder = @"Search";
like image 63
Suresh Varma Avatar answered Sep 22 '22 23:09

Suresh Varma


[self.searchBar setPlaceholder:@"search"]
like image 43
booker Avatar answered Sep 22 '22 23:09

booker