修改游戏模式下公屏放大缩小
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user