Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS autocomplete feature

What most people mean by autocomplete is that the app has a textview/searchbar/whatever which accepts user input. Attached to this component is a tableview which keeps updating based on the user input. This is a well researched topic and is now relatively easy to implement thanks to the UISearchDisplay controller.

Now here is what I want. When the user is typing in some text in the UISearchBar, there will be no searchdisplaycontroller. Instead, I want the app to do something like Google Instant on desktops. That is, if I type "Goog", the searchbar should show Goog*le. So the suggestion "le" should be in a lighter font than the rest of the user input string Google. So I don't want an auto-suggest feature, I want an autocomplete feature.

Any ideas on how I can do this?

Thanks!

like image 231
Neo Avatar asked Oct 13 '11 17:10

Neo


1 Answers

Alternatively, you can use this UITextField subclass (inspired by DOAutocompleteTextField):

https://github.com/hoteltonight/HTAutocompleteTextField

It's got a few more features and is actively developed. The example shows you how to use an array as the data source for the autosuggest text.

like image 200
codeperson Avatar answered Sep 27 '22 22:09

codeperson