Is there a delegate call when iOS keyboard language changes?

前端 未结 1 1321
日久生厌
日久生厌 2021-01-19 03:30

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 achi

相关标签:
1条回答
  • 2021-01-19 04:01

    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.

    0 讨论(0)
提交回复
热议问题