添加举报

This commit is contained in:
2026-01-29 16:42:43 +08:00
parent 26096abbcc
commit b556e6841d
11 changed files with 535 additions and 62 deletions

View File

@@ -31,6 +31,8 @@
@property (nonatomic, assign) CGFloat voiceInputBarHeight;
@property (nonatomic, assign) CGFloat baseInputBarBottomSpacing;
@property (nonatomic, assign) CGFloat currentKeyboardHeight;
/// KBVoiceInputBar
@property (nonatomic, assign) BOOL voiceInputKeyboardActive;
@property (nonatomic, strong) UITapGestureRecognizer *dismissKeyboardTap;
@property (nonatomic, weak) LSTPopView *chatLimitPopView;
@@ -76,6 +78,31 @@
@implementation KBAIHomeVC
#pragma mark - Keyboard Gate
/// view firstResponder
- (UIView *)kb_findFirstResponderInView:(UIView *)view {
if ([view isFirstResponder]) {
return view;
}
for (UIView *sub in view.subviews) {
UIView *found = [self kb_findFirstResponderInView:sub];
if (found) {
return found;
}
}
return nil;
}
/// KBVoiceInputBar
- (BOOL)kb_isKeyboardFromVoiceInputBar {
UIView *firstResponder = [self kb_findFirstResponderInView:self.view];
if (!firstResponder) {
return NO;
}
return [firstResponder isDescendantOfView:self.voiceInputBar];
}
#pragma mark - Lifecycle
- (void)viewDidLoad {
@@ -353,6 +380,21 @@
// frame view
CGRect convertedFrame = [self.view convertRect:endFrame fromView:nil];
CGFloat keyboardHeight = MAX(0.0, CGRectGetMaxY(self.view.bounds) - CGRectGetMinY(convertedFrame));
// Gate KBVoiceInputBar
if (keyboardHeight > 0.0) {
if (![self kb_isKeyboardFromVoiceInputBar]) {
return;
}
self.voiceInputKeyboardActive = YES;
} else {
// KBVoiceInputBar
if (!self.voiceInputKeyboardActive) {
return;
}
self.voiceInputKeyboardActive = NO;
}
self.currentKeyboardHeight = keyboardHeight;
NSLog(@"[KBAIHomeVC] 键盘高度: %.2f, 屏幕高度: %.2f, 键盘 Y: %.2f",