|
此问题请按照如下方法去解决。 在JSQMessagesViewController.m中,用以下代码替换原来的整个方法代码即可: - (void)keyboardController:(JSQMessagesKeyboardController *)keyboardController keyboardDidChangeFrame:(CGRect)keyboardFrame
{
if (![self.inputToolbar.contentView.textView isFirstResponder] && self.toolbarBottomLayoutGuide.constant == 0.0) {
return;
}
CGFloat heightFromBottom = CGRectGetMaxY(self.collectionView.frame) - CGRectGetMinY(keyboardFrame);
heightFromBottom = MAX(0.0, heightFromBottom);
// 当前是否是关闭键盘(YES表示是,否则不是)
BOOL toHide = (heightFromBottom == 0);
if(toHide)
{
// HACK:【隐藏键盘时,如果发现当前的“更多”模式不为“无”时,就设置“更多”功能区的显示】:
if(self.bottomBoxContentViewState != RBBottomBoxContentViewStateNone)
{
heightFromBottom = k_RBBottomBoxViewHeight;
}
}
else
{
// 当前“更多”功能显示模式和软键盘(文本输入模式)是互斥的,打开了文本输入则强制切换“更多”功能显示模式为“无”(即不显示它们)【1/2】
self.bottomBoxContentViewState = RBBottomBoxContentViewStateNone;
// 留海屏的安全区下方衬距
CGFloat safeAreaInsets_bottom = [self getSafeAreaInsets_bottom];
heightFromBottom = heightFromBottom - safeAreaInsets_bottom;
}
[self jsq_setToolbarBottomLayoutGuideConstant:heightFromBottom];
// 本次是打开键盘时(也就是准备输入文字消息时哦)
if(!toHide)
{
// 主动将消息列表滚动到最后一行,以便用户看到
[self scrollToBottomAnimated:YES];
}
}
- (CGFloat)getSafeAreaInsets_bottom
{
if (@available(iOS 11.0, *))
return [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom;
return 0;
}以下是解决后的效果:
|
引用:JackJiang 发表于 2020 这个问题如果找到了,希望能给个具体的代码解决方案,因为我想去解决它但是搞不定 |
| 多谢反馈,问题已经记录了,我会安排人来优化的。 |
| 之前的版本一直也有这个问题 |