通过官方的方法能否得知用户目前使用的输入法是否第三方输入法
To ask the system to switch to another keyboard, call the advanceToNextInputMode method (..) The system picks the appropriate “next” keyboard; there is no API to obtain a list of enabled keyboards or for picking a particular keyboard to switch to.
从上述苹果的正式文档当中描述,是没有一个列表来获取的。
2 回答1k 阅读
1 回答1.1k 阅读✓ 已解决
1 回答2.7k 阅读
1 回答1.5k 阅读
1 回答1.4k 阅读
1.7k 阅读
1 回答1.1k 阅读
从键盘事件(比如
UIKeyboardWillShowNotification
)中,得不到使用是哪个输入法。只能得到类似下面的信息:所以感觉使用正常渠道可能得不到这个信息,不过使用私有API可以获取得到当前输入法的Id:
输出大概是这样的:
有三个是系统自带的,三个是第三方的。
共涉及到两个私有API类:分别是,
UIKeyboardInputModeController
和UIKeyboardInputMode
。这是我的头文件,你放入工程就可以用了: