Are there Notifications or Delegate functions that detect switching keyboard language?
When I press Language Key in keyboard .. I need a delegate function that handle this in the code to change the direction of UITextfield.
Are there Notifications or Delegate functions that detect switching keyboard language?
When I press Language Key in keyboard .. I need a delegate function that handle this in the code to change the direction of UITextfield.
According to this answer:
The answer is that when you switch languages, the UIKeyboardDidShowNotification fires for each change
So you'll just have to register for that notification and then run your code:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWasShown:) name:UIKeyboardDidShowNotification object:nil];
- (void)keyboardWasShown:(NSNotification *)notification
{
NSString * currentLanguage = [UITextInputMode currentInputMode].primaryLanguage;
}
Update
The above method doesn't work, however if we register to UITextInputCurrentInputModeDidChangeNotification
we do get a callback.