Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a delegate call when iOS keyboard language changes?

Tags:

ios

keyboard

ios5

I have a scenario where I'd like to have a handler that gets triggered when the user presses the language change(globe icon) on the keyboard for iOS.

How I may achieve that?

Thanks

like image 603
Adrian Avatar asked Nov 04 '22 18:11

Adrian


1 Answers

The following should work: You would have to use a UIKeyboard notification within your code

   [[NSNotificationCenter defaultCenter] addObserver:self
             selector:@selector(keyboardWillBeHidden:)
             name:UIKeyboardWillHideNotification object:nil];

Then within your keyboardWillBeHidden: or similarly named method use the answer (link below) which returns you a two letter code for the currently selected language.

Link: Getting current device language in iOS?

So your method keyboardWillBeHidden: method is called when the keyboard is hidden reads from the system the keyboard language option that is currently selected.

Thats the theory, I haven't tried this myself, good luck.

like image 81
Des Avatar answered Nov 09 '22 13:11

Des