ios - 如何更改 IOS 搜索栏中的默认文本?

标签 ios text uisearchbar

嗨,我在 IOS 中开发了一个应用程序,我遇到了一个问题,我想将搜索栏中的默认文本“搜索”更改为“键入要搜索的视频标题”。怎么做 ?请帮助我谢谢。 enter image description here

最佳答案

UISearchBarUITextField 具有 placeholder 属性,它是字段中的默认文本。

1.从 Interface Builder 更改它。 Interface Builder

2.通过代码修改

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

阅读what Apple has written关于 UISearchField

关于ios - 如何更改 IOS 搜索栏中的默认文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20112080/

相关文章:

ios - 使用 NSFetchedResultsController 在 TableView 上显示的元素列表与底层 CoreData 实体不匹配

ios - iOS 上的 Xamarin Forms 如何设置页面的屏幕方向?

ios - 初始化父View的父View问题

text - 量化文本关键字以进行神经网络分析

ios - TableViewController 中 SearchBar 中的取消按钮需要双击

iOS8 UISplitViewController 始终在滑动手势时打开主 Controller

c - 如何确定 C 中的 Unix 文本文件?

python - 有没有办法从 Python 编写格式化文本?

iphone - 将 uisearchDisplayController TableView 样式更改为分组?

ios - UITextField/UITextView/UISearchBar 上的死锁/硬卡住成为FirstResponder