开发者

iOS autocomplete feature

开发者 https://www.devze.com 2023-04-13 00:39 出处:网络
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

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 th开发者_StackOverflow社区e 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!


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.


I haven't tried it but here's a control that appears to do what you're asking for:

http://cocoacontrols.com/platforms/ios/controls/doautocompletetextfield

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号