2013-11-21 89 views
2

HI我在IOS中開發了一個應用程序,我遇到了一個問題,我想要將搜索欄中的「搜索」的默認文本更改爲「輸入要搜索的視頻標題」。怎麼做 ?請幫助我,謝謝。 enter image description here如何更改IOS中搜索欄中的默認文本?

+2

問這樣的問題之前,請花一分鐘來掃描文檔。在30秒內你已經找到了正確的'UISearchBar'屬性。 – rmaddy

+0

對不起監守我是新手,下一次我會先掃描文檔。 – tommy

回答

8

UISearchBarUITextFieldplaceholder這是在字段的默認文本此屬性。

1.將其從Interface Builder中更改。 Interface Builder

2.Change它通過代碼

self.searchBarObject.placeholder = @"Key In Video Title To Search"; 

閱讀what Apple has written有關UISearchField

+1

thanx man ..很好很容易 –

2

您可以使用普通的老placeholder屬性:

mySearchBar.placeholder = @"Foo!"; 

Relevant documentation

也可以Interface Builder的範圍內變化:

enter image description here

2

您可以設置佔位符屬性

sBar.placeholder = @"Key in video title to search"; 
相關問題