实现在iPad上自动完成 [英] Implement auto-completion on iPad
问题描述
情景:我有药物的列表(存储在某个地方,比方说一个NSArray)
Scenario: I have a list of medication (stored somewhere, let's say an NSArray).
有一个的UITextField用户可以在其中输入药物,以获取有关它(或其他)。更多信息
There is a UITextField where a user can enter a medication to get more information about it (or whatever).
我想建议单词补全,而他是打字(但是这是比较容易)。
I want to suggest word completions while he is typing (but that is rather easy).
在哪里是要表明这些建议的最佳地点?因为它是在iPad上,我想,当你google一下还挺喜欢的,你会得到正下方的搜索栏您的建议。这有可能在iPad上?这奠定了在屏幕的其余部分表,放在下面的文本字段?就像一个弹出的东西?我从来没有真正使用一台iPad在我的生活之前,所以我不知道iOS的方法是什么。
Where is the best place to show these suggestions? Since it's on the iPad i want it kinda like when you google and you get your suggestions right below the search bar. Is that possible on the iPad? A table that lays over the rest of the screen, placed below the text field? Like a pop up or something? I have never really used an iPad in my life before, therefore I don't know what the iOS way would be..
编辑:事情是这样的,但连接到一个文本框,而不是一个按钮或什么的事情是:
Something like this but connected to a textfield and not a button or whatever that thing is:
编辑:或甚至更好:事情是这样的,但iPad和Android的不是:
Or even better: Something like this but for iPad and not Android:
推荐答案
在我的应用我用了一个的UITableView
显示的建议。
In my app I used a UITableView
for displaying the suggestion.
我添加了上述的tableView我的的UITextField
。如果没有自动完成的话发现,我隐藏的tableView。
I added the tableView above my UITextField
. When there is no auto complete word found, I hide the tableView.
请查看我的自动完成实现。
Please check my autocomplete implemetation.
这篇关于实现在iPad上自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!