我正在使用UIKeyboardWillShowNotification
和UIKeyboardWillHideNotification
处理键盘。
这是显示键盘时调用的函数:
-(void) keyboardWillShow:(NSNotification *)note
{
CGRect keyboardBounds;
//[[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] getValue: &keyboardBounds];
NSValue* keyboardFrameBegin = [note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey];
keyboardBounds = [keyboardFrameBegin CGRectValue];
}
我得到keyboardBounds = (0, 524, 320, 44),我使用的是5s。不知道为什么origin.y来了 524(应该在 300 附近)和高度为 44 !我也尝试过注释行。键盘绑定的两种方式都是44。此问题仅适用于 swift keyboard。和这个问题
一样