4

如何检测国际键盘的隐藏事件? UIKeyboardDidHideNotification似乎没有触发。

下面的相关链接没有帮助。

检测国际键盘的出现和消失

更多信息

这就是我为两者设置通知的UIKeyboardDidHideNotification方式UIKeyboardDidShowNotification

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];

-(void)keyboardDidShow:(NSNotification*)notification {
    NSLog(@"keyboardDidShow");
}
-(void)keyboardDidHide:(NSNotification*)notification {
    NSLog(@"keyboardDidHide");
}

keyboardDidShow被触发两次。首先是标准键盘弹出时。其次是国际键盘弹出时。

keyboardDidHide当我隐藏国际键盘时不会触发。但是当标准键盘隐藏时触发。

我错过了什么吗?

4

1 回答 1

0

如果用户更改键盘,您不会收到任何通知。仅当键盘出现或消失时。

我知道的唯一解决方案是观察或对变化做出反应(试试 KVO?)

[UITextInputMode currentInputMode].primaryLanguage

另请参阅:检测当前 iPhone 输入语言

于 2013-08-21T05:29:17.943 回答