[英]How to change the default text in Search Bar in IOS?
HI I develop an application in IOS and I meet a problem that I want to change the default text which is "search" in search bar to "Key in video title to search". 我在IOS中开发了一个应用程序,我遇到了一个问题,我想将搜索栏中“搜索”的默认文本更改为“键入视频标题进行搜索”。 How to do it ?
怎么做 ? Please help me Thank you.
请帮帮我谢谢。
The UISearchBar
and the UITextField
have this property of a placeholder
which is the default text in the fields. UISearchBar
和UITextField
具有placeholder
此属性,该placeholder
是字段中的默认文本。
1.Change it from the Interface Builder. 1.从Interface Builder中更改它。
2.Change it through code 2.通过代码改变它
self.searchBarObject.placeholder = @"Key In Video Title To Search";
Read what Apple has written about the UISearchField
. 阅读Apple撰写的关于
UISearchField
。
You can use the plain old placeholder
property: 您可以使用普通的旧
placeholder
属性:
mySearchBar.placeholder = @"Foo!";
Relevant documentation . 相关文件 。
It can also be changed within Interface Builder: 它也可以在Interface Builder中更改:
您可以设置占位符属性
sBar.placeholder = @"Key in video title to search";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.