在iOS中实现自动完成自动完成、iOS

2023-09-11 00:04:26 作者:醉卧伊人膝

我创造,我需要实现自动完成,当用户正在输入到一个文本输入,与出现下面的文本字段中的10就近/排名最高的单词的应用程序。

I am creating an application where I need to implement autocompletion when a user is typing into an text input, with the 10 nearest/highest ranking words appearing below the text field.

我已经得到的的约80000字一个相当大名单及其各自的优先 - 一些决定取决于数量的大小,他们有多高出现在自动完成,像这样的:

I've been given a fairly big list of around 80,000 words and their respective 'priority' - a number which determines how high up they appear in the autocomplete depending on the size of the number, like this:

"transport international";19205
"taxi";18462
"location de voitures";18160
"police";18126
"formation";17858

我还挺新的iOS开发,并想知道什么是做到这一点的最好办法 - 我应该拆分80,000短语成更小的文件,或者只是保持在一个?什么是快?

I am kinda new to iOS development and was wondering what is the best way to do this - should I split the 80,000 phrases into smaller files, or just keep it in one? What would be faster?

我已经看到了针对iOS的例子中使用自动完成,但它是一个非常少量的建议 - 我还没有看到它这样做的大前使用的文件,很明显,我想使它尽可能快为增加用户体验。

I have seen autocompletion used in an example for iOS but it was for a very small amount of suggestions - I haven't seen it done using a file this large before, and obviously I would like to make it as fast as possible for added user experience.

任何建议例子,教程或code建议将不胜AP preciated,谢谢。

Any suggestions as to examples, tutorials or code suggestions would be greatly appreciated, thanks.

推荐答案

您可能希望使用此回购 HTAutocompleteTextField ,完美的解决方案

You may want to use this repo HTAutocompleteTextField, perfect solution.