iOS键盘语言更改时是否有委托调用? [英] Is there a delegate call when iOS keyboard language changes?

查看:97
本文介绍了iOS键盘语言更改时是否有委托调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我希望在用户按下iOS键盘上的语言更改(地球图标)时触发处理程序。

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.

我如何实现这一目标?

谢谢

推荐答案

以下应该工作:
您必须在代码中使用UIKeyboard通知

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];

然后在你的 keyboardWillBeHidden:或类似名称方法使用答案(下面的链接),它为您返回当前所选语言的双字母代码。

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.

链接:在iOS中获取当前的设备语言?

所以你的方法 keyboardWillBeHidden:隐藏键盘时调用方法从系统中读取当前选中的键盘语言选项。

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.

这篇关于iOS键盘语言更改时是否有委托调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆