简体   繁体   中英

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". 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.

1.Change it from the Interface Builder. Interface Builder

2.Change it through code

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

Read what Apple has written about the UISearchField .

You can use the plain old placeholder property:

mySearchBar.placeholder = @"Foo!";

Relevant documentation .

It can also be changed within Interface Builder:

在此输入图像描述

您可以设置占位符属性

sBar.placeholder = @"Key in video title to search";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM