[UITextFieldVariable becomeFirstResponder]; is bringing the keyboard on to the screen.
How can I detect when a user types in a letter on the keyboard? I'd like to know each time a key has been pressed.
Thanks so much in advance!
Use the NSNotificationCenter
and take a look at the UITextFieldTextDidChangeNotification
.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textFieldChanged)
name:UITextFieldTextDidChangeNotification
object:textField];
Now implement a function -(void)textFieldChanged;
and each time this function gets called compare the new text in the UITextField
with the old text. Whatever has changed is the button that was pressed.
Do something similar for UITextFieldTextDidBeginEditingNotification
and UITextFieldTextDidEndEditingNotification
to ensure that buttons were pressed even though no text was typed (like pressing backslash).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With