diff --git a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m index d94d07fa..652f5cc0 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m @@ -5,6 +5,8 @@ // Created by P on 2025/1/13. // +//banner 手势处理会有遮挡其他视图操作的问题 + #import "RoomAnimationView.h" #import @@ -201,6 +203,9 @@ XPRoomGraffitiGiftAnimationViewDelegate self.hostDelegate = hDelegate; [[NIMSDK sharedSDK].broadcastManager addDelegate:self]; + // 确保RoomAnimationView可以接收用户交互 + self.userInteractionEnabled = YES; + [self setup]; } return self; @@ -1165,7 +1170,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG NSLog(@"🧪 原始banner类型: %@", NSStringFromClass([obj class])); // 添加原始数据 - [self.roomBannertModelsQueueV2 addObject:obj]; + [self.roomBannertModelsQueueV2 addObject:obj]; // 复制指定份数 for (int i = 1; i < copyCount; i++) { @@ -4027,4 +4032,34 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG } } +#pragma mark - Touch Event Handling + +- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event { + // 检查是否有banner显示 + if (self.bannerContainer.subviews.count == 0) { + NSLog(@"🎯 没有banner显示,不接收触摸事件"); + return NO; + } + + // 检查banner容器是否可见 + if (self.bannerContainer.hidden || self.bannerContainer.alpha <= 0.01) { + NSLog(@"🎯 banner容器不可见,不接收触摸事件"); + return NO; + } + + // 检查触摸点是否在bannerContainer区域内 + CGPoint bannerPoint = [self.bannerContainer convertPoint:point fromView:self]; + if (CGRectContainsPoint(self.bannerContainer.bounds, bannerPoint)) { + NSLog(@"🎯 触摸在banner区域内,接收触摸事件"); + return [super pointInside:point withEvent:event]; + } + + // 在banner区域外,不接收触摸事件,让下层视图处理 + NSLog(@"🎯 触摸在banner区域外,穿透到下层视图 - 触摸点:(%.1f,%.1f) banner区域:(%.1f,%.1f,%.1f,%.1f)", + point.x, point.y, + self.bannerContainer.frame.origin.x, self.bannerContainer.frame.origin.y, + self.bannerContainer.frame.size.width, self.bannerContainer.frame.size.height); + return NO; +} + @end