Is it possible to detect when the "@123" is pressed on the keyboard? I have a custom input accessory view that I want to change depending what keyboard is shown to the user.
Asked
Active
Viewed 682 times
1
-
See http://stackoverflow.com/questions/21255323/how-to-detect-when-the-ios-default-keyboard-type-switches-from-text-to-numbers – rmaddy Apr 14 '14 at 23:07
-
I am also trying to find out the possible option of the same issue. I want to manually trigger @123 button press event after launching keyboard. Did you find any solution for this?? – Srini Jun 22 '15 at 18:03
1 Answers
0
To quote from the following link
You can register for the UITextInputCurrentInputModeDidChangeNotification
to be alerted when the current input mode changes."
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(inputModeDidChange:)
name:UIKeyboardCurrentInputModeDidChangeNotification
object:nil];
and
- (void)inputModeDidChange:(NSNotification*)notification
{
id obj = [notification object];
if ([obj respondsToSelector:@selector(inputModeLastUsedPreference)]) {
id mode = [obj performSelector:@selector(inputModeLastUsedPreference)];
NSLog(@"mode: %@", mode);
}
}
Possible duplicate, have you looked at
this post (Detecting current iPhone input language) or this post (how to detect when the iOS default keyboard type switches from text to numbers)
-
`UITextInputCurrentInputModeDidChangeNotification` is only notified when language changes, not when the keyboard changes from, say, alphabet to numbers. – mattsson Jan 26 '16 at 12:08