Johnykutty
Johnykutty

Reputation: 12859

giving custom autosuggestion for uitextfield iphone

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?

Upvotes: 2

Views: 6229

Answers (3)

Tatarasanu Victor
Tatarasanu Victor

Reputation: 654

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

enter image description here

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

Upvotes: 3

Hashim MH
Hashim MH

Reputation: 1576

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

Upvotes: 4

Saad
Saad

Reputation: 8947

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.

Upvotes: 1

Related Questions