1

In my app, I have a simple textfield set up for the user's zip code while registering:

I am listening for changes to the textfield as so:

[self.zipCode addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];

However, if the user begins typing and their ZIP code is shown as a suggestion above the keyboard, textFieldDidChange: is not called when the user taps that suggestion.

What control event should I be listening for to also include keyboard suggestions being selected?

Rishil Patel
  • 1,977
  • 3
  • 14
  • 30
Adam G
  • 1,188
  • 10
  • 24
  • I have created a new project and tried your code. `textFieldDidChange:` is called when you click on suggestion. Check your project again, maybe problem is from another place. – trungduc Mar 19 '18 at 01:36

1 Answers1

0

I have checked your code and it is working fine.

textFieldDidChange: not getting call that means something wrong. So please check.

So please check :

1) add UITextFieldDelegate in your class.

2) self.zipCode.delegate = self;

Note : Make sure if you have not created self.zipCode programmatically So you must have to check your textfield connection with storyboard.

If you need more help you can ask me :)

Rishil Patel
  • 1,977
  • 3
  • 14
  • 30