反复测试,打印[[notification userInfo] 数据分析,发现以下条件可以判断出是第三次回调,欢迎验证: - (void)keyboardWillShow:(NSNotification *)notification { CGFloat curkeyBoardHeight = [[[notification userInfo] objectForKey:@"UIKeyboardBoundsUserInfoKey"] CGRectValue].size.height; CGRect begin = [[[notification userInfo] objectForKey:@"UIKeyboardFrameBeginUserInfoKey"] CGRectValue]; CGRect end = [[[notification userInfo] objectForKey:@"UIKeyboardFrameEndUserInfoKey"] CGRectValue]; // 第三方键盘回调三次问题,监听仅执行最后一次 if(begin.size.height>0 && (begin.origin.y-end.origin.y>0)){ keyBoardHeight = curkeyBoardHeight; [self showKeyboard:notification]; } }
29,027
社区成员
12,466
社区内容
加载中
试试用AI创作助手写篇文章吧