Jobs
Jobs

Reputation: 259

How to create autocomplete[real time] text field in iOS, which provides suggestions as you type

I'm working on a app. it has texfields.What I want is when user type something in the textfield("as an exmple think user types letter 'y'") then below the text field , should show realtime all available names in start from 'y' as dropdown list. then user should be able to select one from it.then the selected items should display in the textfield.how can we do this.

Upvotes: 3

Views: 6281

Answers (3)

pishke
pishke

Reputation: 11

Here you have another library that makes exactly what you need: https://github.com/apasccon/SearchTextField

Upvotes: 1

seto nugroho
seto nugroho

Reputation: 1379

Here is the basic idea for auto complete textfield utilising table view.

  1. create table view under textfield with hidden property set to Yes.
  2. set table view data source based on your unfiltered data.
  3. listen to textfield delegate and call function to filter your data source as well as hide/unhide table view based on textfield delegate.
  4. set textfield.text based on table view selection.

Upvotes: 1

Joe Benton
Joe Benton

Reputation: 3753

This library should help (both Objc and Swift). As you type it filters results and displays a tableview of suitable results underneath.

https://github.com/gaurvw/MPGTextField

(sorry i couldn't add this as a comment)

Upvotes: 0

Related Questions