修改游戏模式下公屏放大缩小

This commit is contained in:
fengshuo
2022-03-24 18:40:23 +08:00
committed by chenguilong
parent f800a66a37
commit 5d43e77028
3 changed files with 47 additions and 3 deletions

View File

@@ -11,13 +11,20 @@
NS_ASSUME_NONNULL_BEGIN
@class XPRoomMessageParser, YYLabel;
@class XPRoomMessageParser, YYLabel, XPRoomMessageTableViewCell;
@protocol XPRoomMessageTableViewCellDelegate <NSObject>
- (void)xPRoomMessageTableViewCellDidTapEmpty:(XPRoomMessageTableViewCell *)view;
@end
@interface XPRoomMessageTableViewCell : UITableViewCell
@property (nonatomic,strong) NSAttributedString *attributedString;
///气泡url
@property (nonatomic, copy) NSString *bubbleImageUrl;
///代理
@property (nonatomic,weak) id<XPRoomMessageTableViewCellDelegate> delegate;
@end

View File

@@ -17,11 +17,13 @@
#import "XPRoomMessageConstant.h"
@interface XPRoomMessageTableViewCell ()
@interface XPRoomMessageTableViewCell ()<UIGestureRecognizerDelegate>
///
@property (nonatomic,strong) NetImageView *bubbleImageView;
///
@property (nonatomic,strong) XPNetImageYYLabel *contentLabel;
///
@property (nonatomic,strong) UITapGestureRecognizer *tapEmptyRecognizer;
@end
@implementation XPRoomMessageTableViewCell
@@ -40,6 +42,10 @@
self.backgroundColor = [UIColor clearColor];
[self.contentView addSubview:self.bubbleImageView];
[self.bubbleImageView addSubview:self.contentLabel];
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap)];
tap.delegate = self;
self.tapEmptyRecognizer = tap;
[self.contentView addGestureRecognizer:self.tapEmptyRecognizer];
}
- (void)initSubViewConstraints {
@@ -66,6 +72,23 @@
return [image resizableImageWithCapInsets:UIEdgeInsetsMake(top, left, bottom, right) resizingMode:UIImageResizingModeStretch];
}
#pragma mark - UIGestureRecognizerDelegate
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if (gestureRecognizer == self.tapEmptyRecognizer) {
if (touch.view == self.contentLabel || touch.view == self.bubbleImageView) {
return NO;
}
}
return YES;
}
#pragma mark - Event Response
- (void)didTap {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPRoomMessageTableViewCellDidTapEmpty:)]) {
[self.delegate xPRoomMessageTableViewCellDidTapEmpty:self];
}
}
#pragma mark - Getters And Setters
- (void)setAttributedString:(NSAttributedString *)attribute {
_attributedString = attribute;

View File

@@ -32,7 +32,7 @@
NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@interface XPRoomMessageContainerView ()<UITableViewDelegate, UITableViewDataSource>
@interface XPRoomMessageContainerView ()<UITableViewDelegate, UITableViewDataSource, XPRoomMessageTableViewCellDelegate>
///
@property (nonatomic,weak) id<RoomHostDelegate> hostDelegate;
@@ -60,6 +60,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
///
@property (nonatomic, strong) dispatch_source_t trumpetTimer;
///
@property (nonatomic,assign) BOOL isLarge;
@end
@@ -517,6 +519,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
if (cell == nil) {
cell = [[XPRoomMessageTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])];
}
cell.delegate = self;
NSAttributedString* attr = [self.datasource objectAtIndex:indexPath.row];
NSString *bubbleStr = [self.messageBubbles objectAtIndex:indexPath.row];
cell.bubbleImageUrl = bubbleStr;
@@ -524,6 +527,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
return cell;
}
- (void)createTrumpetAnimation:(NSDictionary *)attatchment {
self.trumpetView.data = attatchment;
self.trumpetView.hidden = NO;
@@ -577,6 +581,16 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation2"];
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation3"];
}
#pragma mark - XPRoomMessageTableViewCellDelegate
- (void)xPRoomMessageTableViewCellDidTapEmpty:(XPRoomMessageTableViewCell *)view {
if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) {
self.isLarge = !self.isLarge;
CGFloat height = self.isLarge ? 200 : 80;
[self mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(height);
}];
}
}
#pragma mark - Getters And Setters
- (UITableView *)messageTableView {