如何在填写TextField时出现建议?
我是IOS开发新手。我正在尝试添加简单的文本字段来输入职业。我想在用户输入时向用户展示一些匹配的建议(来自我已经拥有的一组职业)。
这是一个非常常见的用例。有这样做的惯用方法吗?在 Android 中,标准视图库中有一个 AutoCompleteTextView,它在初始化期间接收一系列建议。我在 IOS 中找不到类似的东西。
I am new to IOS development. I am trying to add simple TextField for entering Occupation. I would like to show the user some matching suggestions as they user type (from a set of occupations that I already have).
This is a very common usecase. Is there a idiomatic ways of doing this? In Android there is an AutoCompleteTextView
in the standard view library which takes in an array of suggestions during initalization. I could not find anything similar in IOS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用一些可用于自动完成文本字段的第三方库
但
从我的角度来看,最好、最简单的方法是使用 UITextField 并在底部添加 UITableview。所以这个概念是,当您在文本字段中键入任何字符时,您需要从表视图中过滤一些数据并重新加载表视图
检查下面的链接,您可以从这里获得合适的答案...
让自动完成功能在 swift 中工作
You can use some 3rd party libraries available for Auto complete text field
but
the best and easy approach from my perspective is to use UITextField and at bottom add UITableview. So the concept is when you type any character in textfield you need to filter some data from tableview and reload tableview
Check the below link you can get the suitable answer from here...
Getting autocomplete to work in swift