giving custom autosuggestion for uitextfield iphone

三世轮回 提交于 2019-12-08 02:21:39

问题


I have to implement a custom autosuggestion for UITextField> I have an array of words and when I start typing in a textfield then all words similar to the typed text should appear as auto suggestion, like normal auto suggestion in ios but more than one word. And When I tap on one of them it should trigger an event. I know how to done this with a tableview anybody know a method to done this with ios's look and feel?


回答1:


For this purpose I used the project linked below: http://cocoacontrols.com/platforms/ios/controls/autocompletiontableview




回答2:


A sexy look for a autocomplete:

UITextField + UITextFieldDelegate http://www.cocoacontrols.com/search?utf8=%E2%9C%93&q=wepopover

Using UITableView you keep the data and apply an predicate on:

  • (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

I didn't attach source code because isn't general and might confuse you.




回答3:


Make an array of NSString, and search the typed string in UITextfield delegate method textChanged:, then print strings in a tableView.

In fact this will work like a UISearchBar.



来源:https://stackoverflow.com/questions/10550163/giving-custom-autosuggestion-for-uitextfield-iphone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!