An open API service indexing awesome lists of open source software.

https://github.com/yonat/yonautocomplete

Add auto-completion to a UITextField
https://github.com/yonat/yonautocomplete

autocomplete uitextfield

Last synced: about 1 year ago
JSON representation

Add auto-completion to a UITextField

Awesome Lists containing this project

README

          

## YONAutoComplete - Add auto-completion to a UITextField

Simplest auto-complete:
just create a `YONAutoComplete` object and assign it as the delegate of a `UITextField`:

```objective-c
YONAutoComplete *autoComplete = [YONAutoComplete new];
textField.delegate = autoComplete;
```

The user can either choose from the list of completions, or type a new value that will be added to the list automatically.

If you need to have your own delegate for the text field, set it on the `YONAutoComplete` instance:

```objective-c
autoComplete.textFieldDelegate = myTextFieldDelegate;
```

### Customization

You can use pre-assembled completions list from a text file:

```objective-c
autoComplete.completionsFileName = @"SomeFileName";
```

Or set the completions list programmatically:

```objective-c
autoComplete.completions = @[@"First Item", @"Second Item"];
```

To prevent user-typed values from being added to the completions list:

```objective-c
autoComplete.freezeCompletionsFile = YES;
```

Limit number of completions shown:
```objective-c
autoComplete.maxCompletions = 7;
```

## Installation

### CocoaPods:

```ruby
pod 'YONAutoComplete'
```