Custom inputView for UITextField , how do I direct input back to the text field?

Darren Findlay picture Darren Findlay · Apr 10, 2012 · Viewed 7.9k times · Source

I have set a custom inputView to my UITextField. I need a way to display the data selected in my custom inputView in the UITextfield. I would like to achieve this the same way the system keyboard does it.

Does anyone know how this is done? How does the system keyboard get a reference to the UITextfield that is the first responder?

Answer

Joshua J. McKinnon picture Joshua J. McKinnon · Oct 14, 2012

When sending input from your custom input view back to the textfield, note that you can (should) use the UIKeyInput protocol methods that UITextField conforms to. Namely:

- (void)deleteBackward;
- (void)insertText:(NSString *)text;