Commit cba0d72894b1f533469e0b363dbdd42eca6a1144
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud
Conflicts: LiveVideoCloud/LiveVideoCloud/PrefixHeader.pch
Showing
23 changed files
with
558 additions
and
120 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -168,11 +168,13 @@ |
| 168 | 168 | D25BF89D1E7FE049007FB138 /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D25BF8961E7FE01B007FB138 /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 169 | 169 | D25BF8A01E80C4BD007FB138 /* UIImage+LVCVagueImage.m in Sources */ = {isa = PBXBuildFile; fileRef = D25BF89F1E80C4BD007FB138 /* UIImage+LVCVagueImage.m */; }; |
| 170 | 170 | D25BF8A31E80C4FC007FB138 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D25BF8A21E80C4FC007FB138 /* Accelerate.framework */; }; |
| 171 | + D25BF8A51E80EC76007FB138 /* 头像.jpg in Resources */ = {isa = PBXBuildFile; fileRef = D25BF8A41E80EC76007FB138 /* 头像.jpg */; }; | |
| 171 | 172 | D2888D941E6EB8B4003A77C8 /* LVCTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */; }; |
| 172 | 173 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888D9B1E6EBF1B003A77C8 /* LVCLiveViewController.m */; }; |
| 173 | 174 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; |
| 174 | 175 | D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; |
| 175 | 176 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; }; |
| 177 | + D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; }; | |
| 176 | 178 | /* End PBXBuildFile section */ |
| 177 | 179 | |
| 178 | 180 | /* Begin PBXContainerItemProxy section */ |
| ... | ... | @@ -535,6 +537,7 @@ |
| 535 | 537 | D25BF89E1E80C4BD007FB138 /* UIImage+LVCVagueImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+LVCVagueImage.h"; sourceTree = "<group>"; }; |
| 536 | 538 | D25BF89F1E80C4BD007FB138 /* UIImage+LVCVagueImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+LVCVagueImage.m"; sourceTree = "<group>"; }; |
| 537 | 539 | D25BF8A21E80C4FC007FB138 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; |
| 540 | + D25BF8A41E80EC76007FB138 /* 头像.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "头像.jpg"; sourceTree = "<group>"; }; | |
| 538 | 541 | D2888D921E6EB8B4003A77C8 /* LVCTabBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCTabBar.h; sourceTree = "<group>"; }; |
| 539 | 542 | D2888D931E6EB8B4003A77C8 /* LVCTabBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCTabBar.m; sourceTree = "<group>"; }; |
| 540 | 543 | D2888D9A1E6EBF1B003A77C8 /* LVCLiveViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCLiveViewController.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -545,6 +548,8 @@ |
| 545 | 548 | D2888DB31E6EC154003A77C8 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; }; |
| 546 | 549 | D2888DB51E6EC1B8003A77C8 /* LVCMyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMyViewController.h; sourceTree = "<group>"; }; |
| 547 | 550 | D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; }; |
| 551 | + D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; }; | |
| 552 | + D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; }; | |
| 548 | 553 | /* End PBXFileReference section */ |
| 549 | 554 | |
| 550 | 555 | /* Begin PBXFrameworksBuildPhase section */ |
| ... | ... | @@ -1277,6 +1282,8 @@ |
| 1277 | 1282 | D22830F81E77C2A700627701 /* TopToolView */ = { |
| 1278 | 1283 | isa = PBXGroup; |
| 1279 | 1284 | children = ( |
| 1285 | + D2A803061E80BD6F009D6F1C /* TopToolView.h */, | |
| 1286 | + D2A803071E80BD6F009D6F1C /* TopToolView.m */, | |
| 1280 | 1287 | ); |
| 1281 | 1288 | path = TopToolView; |
| 1282 | 1289 | sourceTree = "<group>"; |
| ... | ... | @@ -1427,6 +1434,7 @@ |
| 1427 | 1434 | isa = PBXGroup; |
| 1428 | 1435 | children = ( |
| 1429 | 1436 | D25BF88F1E7F7F8F007FB138 /* UGCLoading.jpeg */, |
| 1437 | + D25BF8A41E80EC76007FB138 /* 头像.jpg */, | |
| 1430 | 1438 | ); |
| 1431 | 1439 | path = Images; |
| 1432 | 1440 | sourceTree = "<group>"; |
| ... | ... | @@ -1677,6 +1685,7 @@ |
| 1677 | 1685 | D2575C7F1E76A4F300E3A8FC /* NHPlaneViews.xib in Resources */, |
| 1678 | 1686 | D2575C7B1E76A4F300E3A8FC /* NHCarViews.xib in Resources */, |
| 1679 | 1687 | D25BF8901E7F7F8F007FB138 /* UGCLoading.jpeg in Resources */, |
| 1688 | + D25BF8A51E80EC76007FB138 /* 头像.jpg in Resources */, | |
| 1680 | 1689 | D2029CC91E6EADE10027CD92 /* SVProgressHUD.bundle in Resources */, |
| 1681 | 1690 | D2575C801E76A4F300E3A8FC /* resource.bundle in Resources */, |
| 1682 | 1691 | D2029B941E6EAAA50027CD92 /* LaunchScreen.storyboard in Resources */, |
| ... | ... | @@ -1745,6 +1754,7 @@ |
| 1745 | 1754 | D2029CD01E6EADE10027CD92 /* SearchPresenter.m in Sources */, |
| 1746 | 1755 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */, |
| 1747 | 1756 | D2029CBE1E6EADE10027CD92 /* SDWebImagePrefetcher.m in Sources */, |
| 1757 | + D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */, | |
| 1748 | 1758 | 810B65011E779B1F00133E15 /* MASLayoutConstraint.m in Sources */, |
| 1749 | 1759 | D2029CCE1E6EADE10027CD92 /* SearchRecomListModel.m in Sources */, |
| 1750 | 1760 | D2029CA11E6EADE10027CD92 /* NSString+MJExtension.m in Sources */, | ... | ... |
LiveVideoCloud/LiveVideoCloud/AppDelegate/AppDelegate.m
| ... | ... | @@ -34,6 +34,14 @@ |
| 34 | 34 | }];; |
| 35 | 35 | |
| 36 | 36 | [self.window makeKeyAndVisible]; |
| 37 | + | |
| 38 | + [[CNLiveChatManager sharedCNLiveChatManager] initWithAppKey:AppKey appId:AppId]; | |
| 39 | + [[CNLiveChatManager sharedCNLiveChatManager] connectServerSuccess:^{ | |
| 40 | + | |
| 41 | + } error:^(CNLiveChatConnectErrorCode errors) { | |
| 42 | + | |
| 43 | + }]; | |
| 44 | + | |
| 37 | 45 | return YES; |
| 38 | 46 | } |
| 39 | 47 | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/BottomToolView/BottomToolView.h
| ... | ... | @@ -16,7 +16,7 @@ typedef NS_ENUM(NSInteger, BtnClickType) {//底部按钮类型 |
| 16 | 16 | |
| 17 | 17 | @protocol bottomBtnDeledate <NSObject> |
| 18 | 18 | |
| 19 | -- (void)bottomActionWithType:(BtnClickType)btnType; | |
| 19 | +- (void)bottomActionWithType:(BtnClickType)btnType button:(UIButton *)button; | |
| 20 | 20 | |
| 21 | 21 | @end |
| 22 | 22 | @interface BottomToolView : BaseView | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/BottomToolView/BottomToolView.m
| ... | ... | @@ -31,22 +31,22 @@ |
| 31 | 31 | #pragma mark - buttonClick |
| 32 | 32 | - (void)chatAction |
| 33 | 33 | { |
| 34 | - if ([self.delegate respondsToSelector:@selector(bottomActionWithType:)]) { | |
| 35 | - [self.delegate bottomActionWithType:BtnClickTypeChat]; | |
| 34 | + if ([self.delegate respondsToSelector:@selector(bottomActionWithType:button:)]) { | |
| 35 | + [self.delegate bottomActionWithType:BtnClickTypeChat button:self.chatBtn]; | |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | - (void)privateChatAction |
| 40 | 40 | { |
| 41 | - if ([self.delegate respondsToSelector:@selector(bottomActionWithType:)]) { | |
| 42 | - [self.delegate bottomActionWithType:BtnClickTypePriChat]; | |
| 41 | + if ([self.delegate respondsToSelector:@selector(bottomActionWithType:button:)]) { | |
| 42 | + [self.delegate bottomActionWithType:BtnClickTypePriChat button:self.privateChatBtn]; | |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | - (void)giftAction |
| 47 | 47 | { |
| 48 | - if ([self.delegate respondsToSelector:@selector(bottomActionWithType:)]) { | |
| 49 | - [self.delegate bottomActionWithType:BtnClickTypeGift]; | |
| 48 | + if ([self.delegate respondsToSelector:@selector(bottomActionWithType:button:)]) { | |
| 49 | + [self.delegate bottomActionWithType:BtnClickTypeGift button:self.giftBtn]; | |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.h
| ... | ... | @@ -14,9 +14,11 @@ |
| 14 | 14 | @property (nonatomic ,copy ) NSString * _Nullable name;//姓名 |
| 15 | 15 | @property (nonatomic ,copy ) NSString * _Nullable content;//内容 |
| 16 | 16 | |
| 17 | +@property (nonatomic ,assign) CGFloat level;//等级 | |
| 17 | 18 | @property (nonatomic ,assign) CGFloat cellWidth;//内容宽度 |
| 18 | 19 | @property (nonatomic ,assign) CGFloat cellHeight;//内容高度 |
| 19 | 20 | |
| 20 | 21 | @property (nonatomic) BOOL isMine;//消息是否是自己发送 |
| 22 | +@property (nonatomic ,copy) NSString * _Nullable ID;//唯一标识 | |
| 21 | 23 | |
| 22 | 24 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
| ... | ... | @@ -17,16 +17,16 @@ |
| 17 | 17 | //如果计算过高度,直接返回 |
| 18 | 18 | if (_cellHeight) return _cellHeight; |
| 19 | 19 | |
| 20 | - //头像 | |
| 21 | - _cellHeight = 40; | |
| 20 | + _cellHeight = 0; | |
| 21 | + NSString *content = [NSString stringWithFormat:@"%@:%@",self.name,self.content]; | |
| 22 | 22 | //文字 |
| 23 | - CGFloat textMaxW = self.cellWidth - 2 * ChatCellMargin; | |
| 23 | + CGFloat textMaxW = self.cellWidth; | |
| 24 | 24 | CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT); |
| 25 | - CGSize textSize = [self.content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:16]} context:nil].size; | |
| 25 | + CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size; | |
| 26 | 26 | |
| 27 | 27 | //底部空隙 |
| 28 | 28 | _cellHeight += textSize.height + ChatCellMargin; |
| 29 | - // NSLog(@"cellHeight = %f",_cellHeight); | |
| 29 | + NSLog(@"cellHeight = %f",_cellHeight); | |
| 30 | 30 | return _cellHeight; |
| 31 | 31 | } |
| 32 | 32 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatViews/chatListCell.h
| ... | ... | @@ -8,8 +8,16 @@ |
| 8 | 8 | |
| 9 | 9 | #import "BaseTableViewCell.h" |
| 10 | 10 | @class chatMsgModel; |
| 11 | + | |
| 12 | +@protocol userClickDelegate <NSObject> | |
| 13 | + | |
| 14 | +- (void)userClickWithModel:(chatMsgModel *)model; | |
| 15 | + | |
| 16 | +@end | |
| 17 | + | |
| 11 | 18 | @interface chatListCell : BaseTableViewCell |
| 12 | 19 | |
| 13 | 20 | - (void)loadUIWithModel:(chatMsgModel *)model; |
| 14 | 21 | |
| 22 | +@property (nonatomic ,strong) id <userClickDelegate> delegate; | |
| 15 | 23 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatViews/chatListCell.m
| ... | ... | @@ -10,11 +10,8 @@ |
| 10 | 10 | #import "chatMsgModel.h" |
| 11 | 11 | @interface chatListCell () |
| 12 | 12 | |
| 13 | -@property (nonatomic ,strong) UIImageView * _Nullable iconImageView;//头像图片 | |
| 14 | -@property (nonatomic ,strong) UILabel * _Nullable nameLabel;//名字 | |
| 13 | +@property (nonatomic ,strong) UIImageView * _Nullable iconImageView;//等级图片 | |
| 15 | 14 | @property (nonatomic ,strong) UILabel * _Nullable contentLabel;//内容 |
| 16 | -@property (nonatomic ,strong) UIImageView * _Nullable lineImageView;//分割线 | |
| 17 | - | |
| 18 | 15 | @property (nonatomic ,strong) chatMsgModel * _Nullable model; |
| 19 | 16 | |
| 20 | 17 | @end |
| ... | ... | @@ -38,50 +35,54 @@ |
| 38 | 35 | |
| 39 | 36 | [self bindView];//更新cell高度后再初始化UI |
| 40 | 37 | [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil]; |
| 41 | - // self.iconImageView.backgroundColor = [UIColor greenColor]; | |
| 42 | - self.nameLabel.text = [NSString stringWithFormat:@"%@:",model.name]; | |
| 43 | - CGSize labelSize = [self.nameLabel labelSize]; | |
| 44 | - self.nameLabel.frame = CGRectMake(self.iconImageView.right + 10, self.iconImageView.top, labelSize.width, labelSize.height); | |
| 45 | - self.nameLabel.centerY = self.iconImageView.centerY; | |
| 46 | - self.contentLabel.text = model.content; | |
| 47 | - CGSize contentLabelSize = [self.contentLabel labelSizeWithWidth:self.width - 2 * self.iconImageView.left]; | |
| 48 | - self.contentLabel.frame = CGRectMake(self.iconImageView.left, self.iconImageView.bottom + 10, contentLabelSize.width, contentLabelSize.height); | |
| 38 | + self.iconImageView.backgroundColor = ZXRandomColor; | |
| 39 | + self.contentLabel.text = [NSString stringWithFormat:@"%@:%@",model.name,model.content]; | |
| 40 | + CGSize contentLabelSize = [self.contentLabel labelSizeWithWidth:self.width - self.iconImageView.right - 4]; | |
| 41 | + self.contentLabel.frame = CGRectMake(20, 0, contentLabelSize.width, contentLabelSize.height); | |
| 42 | + self.contentLabel.centerY = self.height * 0.5; | |
| 43 | + | |
| 44 | + NSString *name = [NSString stringWithFormat:@"%@:",model.name]; | |
| 45 | + NSString *content = model.content; | |
| 46 | + // 创建NSMutableAttributedString | |
| 47 | + NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:self.contentLabel.text]; | |
| 48 | + // 设置文字颜色 | |
| 49 | + [str addAttribute:NSForegroundColorAttributeName value:ZXRandomColor range:NSMakeRange(0, name.length)]; | |
| 50 | + [str addAttribute:NSForegroundColorAttributeName value:[UIColor cyanColor] range:NSMakeRange(name.length, content.length)]; | |
| 51 | + // 将配置好的NSMutableAttributedString传给attributedText属性 | |
| 52 | + self.contentLabel.attributedText = str; | |
| 49 | 53 | |
| 50 | - self.lineImageView.frame = CGRectMake(self.iconImageView.left, self.contentLabel.bottom + 5, self.width - self.iconImageView.left * 2, 1); | |
| 54 | + UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(detailInfo)]; | |
| 55 | + [self.contentLabel addGestureRecognizer:gesture]; | |
| 51 | 56 | } |
| 52 | 57 | |
| 53 | 58 | - (void)bindView |
| 54 | 59 | { |
| 55 | - self.iconImageView.frame = CGRectMake(10, 10, 30, 30); | |
| 56 | - self.nameLabel.frame = CGRectMake(self.iconImageView.right + 10, self.iconImageView.top, self.width - self.iconImageView.right - 20, 25); | |
| 57 | - self.nameLabel.centerY = self.iconImageView.centerY; | |
| 58 | - self.contentLabel.frame = CGRectMake(self.iconImageView.left, self.iconImageView.bottom + 10, self.width - 2 * self.iconImageView.left, 25); | |
| 60 | + self.iconImageView.frame = CGRectMake(4, 0, 16, 10); | |
| 61 | + self.contentLabel.frame = CGRectMake(self.iconImageView.right + 4, 0, self.width - 20, 25); | |
| 62 | + self.contentLabel.centerY = self.height * 0.5; | |
| 63 | + self.iconImageView.centerY = 13.353516; | |
| 64 | +// NSLog(@"Y:%f",self.contentLabel.centerY);//13.353516 | |
| 59 | 65 | } |
| 60 | 66 | |
| 61 | -#pragma mark - getter | |
| 62 | -- (UILabel * _Nullable)nameLabel | |
| 67 | +- (void)detailInfo | |
| 63 | 68 | { |
| 64 | - if (!_nameLabel) | |
| 65 | - { | |
| 66 | - _nameLabel = [[UILabel alloc] init]; | |
| 67 | - _nameLabel.textAlignment = NSTextAlignmentLeft; | |
| 68 | - _nameLabel.textColor = [UIColor redColor]; | |
| 69 | - _nameLabel.font = [UIFont systemFontOfSize:15.f]; | |
| 70 | - [self addSubview:_nameLabel]; | |
| 69 | + if ([self.delegate respondsToSelector:@selector(userClickWithModel:)]) { | |
| 70 | + [self.delegate userClickWithModel:self.model]; | |
| 71 | 71 | } |
| 72 | - return _nameLabel; | |
| 73 | 72 | } |
| 74 | 73 | |
| 74 | +#pragma mark - getter | |
| 75 | 75 | - (UILabel * _Nullable)contentLabel |
| 76 | 76 | { |
| 77 | 77 | if (!_contentLabel) |
| 78 | 78 | { |
| 79 | 79 | _contentLabel = [[UILabel alloc] init]; |
| 80 | 80 | _contentLabel.textAlignment = NSTextAlignmentLeft; |
| 81 | - _contentLabel.textColor = [UIColor lightGrayColor]; | |
| 81 | + _contentLabel.textColor = [UIColor blackColor]; | |
| 82 | 82 | _contentLabel.numberOfLines = 0; |
| 83 | - _contentLabel.font = [UIFont systemFontOfSize:12.f]; | |
| 83 | + _contentLabel.font = [UIFont systemFontOfSize:14.f]; | |
| 84 | 84 | [self addSubview:_contentLabel]; |
| 85 | + _contentLabel.userInteractionEnabled = YES; | |
| 85 | 86 | } |
| 86 | 87 | return _contentLabel; |
| 87 | 88 | } |
| ... | ... | @@ -98,18 +99,6 @@ |
| 98 | 99 | return _iconImageView; |
| 99 | 100 | } |
| 100 | 101 | |
| 101 | -- (UIImageView * _Nullable)lineImageView | |
| 102 | -{ | |
| 103 | - if (!_lineImageView) | |
| 104 | - { | |
| 105 | - _lineImageView = [[UIImageView alloc] init]; | |
| 106 | - _lineImageView.image = [UIImage imageNamed:@"分割线(聊天复用)"]; | |
| 107 | - [self addSubview:_lineImageView]; | |
| 108 | - } | |
| 109 | - return _lineImageView; | |
| 110 | -} | |
| 111 | - | |
| 112 | - | |
| 113 | 102 | /* |
| 114 | 103 | // Only override drawRect: if you perform custom drawing. |
| 115 | 104 | // An empty implementation adversely affects performance during animation. | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimOperation.m
| ... | ... | @@ -33,6 +33,11 @@ |
| 33 | 33 | + (GiftAnimOperation *)addGiftAnimOperationWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView{ |
| 34 | 34 | |
| 35 | 35 | GiftAnimOperation *giftAnimOperation = [[GiftAnimOperation alloc]initWithGiftModel:model animContentView:animContentView]; |
| 36 | + | |
| 37 | + if (model.giftStyle == GiftStyleFighter) { | |
| 38 | + [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStart) name:NSNotificationAnimationDidStart object:nil]; | |
| 39 | + [[NSNotificationCenter defaultCenter] addObserver:giftAnimOperation selector:@selector(fighterAnimationDidStop) name:NSNotificationAnimationDidStop object:nil]; | |
| 40 | + } | |
| 36 | 41 | return giftAnimOperation; |
| 37 | 42 | } |
| 38 | 43 | |
| ... | ... | @@ -101,7 +106,6 @@ |
| 101 | 106 | |
| 102 | 107 | [self didChangeValueForKey:@"isFinished"]; |
| 103 | 108 | }]; |
| 104 | - | |
| 105 | 109 | }); |
| 106 | 110 | } |
| 107 | 111 | |
| ... | ... | @@ -113,18 +117,23 @@ |
| 113 | 117 | |
| 114 | 118 | [self.giftFighterView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 60) endPoint:CGPointMake( -500, 600)]; |
| 115 | 119 | [self.animContentView addSubview:self.giftFighterView]; |
| 116 | - | |
| 117 | - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 118 | - [self willChangeValueForKey:@"isFinished"]; | |
| 119 | - | |
| 120 | - _finished = YES; | |
| 121 | - | |
| 122 | - [self didChangeValueForKey:@"isFinished"]; | |
| 123 | - | |
| 124 | - }); | |
| 125 | 120 | }); |
| 126 | 121 | } |
| 127 | 122 | |
| 123 | +- (void)fighterAnimationDidStart | |
| 124 | +{ | |
| 125 | + | |
| 126 | +} | |
| 127 | + | |
| 128 | +- (void)fighterAnimationDidStop | |
| 129 | +{ | |
| 130 | + [self willChangeValueForKey:@"isFinished"]; | |
| 131 | + | |
| 132 | + _finished = YES; | |
| 133 | + | |
| 134 | + [self didChangeValueForKey:@"isFinished"]; | |
| 135 | +} | |
| 136 | + | |
| 128 | 137 | - (void)planeAnimation |
| 129 | 138 | { |
| 130 | 139 | weakself |
| ... | ... | @@ -142,7 +151,6 @@ |
| 142 | 151 | |
| 143 | 152 | [self didChangeValueForKey:@"isFinished"]; |
| 144 | 153 | }]; |
| 145 | - | |
| 146 | 154 | }); |
| 147 | 155 | } |
| 148 | 156 | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimationAction.h
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHFighterView+animDelegagte.m
| ... | ... | @@ -13,14 +13,12 @@ |
| 13 | 13 | |
| 14 | 14 | - (void)animationDidStart:(CAAnimation *)anim |
| 15 | 15 | { |
| 16 | - NSLog(@"did start"); | |
| 16 | + [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStart object:nil]; | |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag |
| 20 | 20 | { |
| 21 | -// _giftAnimationCompletion(); | |
| 22 | - | |
| 23 | - NSLog(@"did stop"); | |
| 21 | + [[NSNotificationCenter defaultCenter] postNotificationName:NSNotificationAnimationDidStop object:nil]; | |
| 24 | 22 | } |
| 25 | 23 | |
| 26 | 24 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LVCAnimationManager.h
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LVCAnimationManager.m
| ... | ... | @@ -81,4 +81,20 @@ static LVCAnimationManager * __singleton__; |
| 81 | 81 | [self.toView bubblingWithImage:[UIImage imageNamed:loveImageName] center:self.centerPoint]; |
| 82 | 82 | [self.toView bubblingWithImages:__singleton__.images center:self.centerPoint]; |
| 83 | 83 | } |
| 84 | + | |
| 85 | +/** | |
| 86 | + 暂停飘心 | |
| 87 | + */ | |
| 88 | +- (void)suspend | |
| 89 | +{ | |
| 90 | + [self.link setPaused:YES]; | |
| 91 | +} | |
| 92 | + | |
| 93 | +/** | |
| 94 | + 恢复飘心 | |
| 95 | + */ | |
| 96 | +- (void)resume | |
| 97 | +{ | |
| 98 | + [self.link setPaused:NO]; | |
| 99 | +} | |
| 84 | 100 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| ... | ... | @@ -16,6 +16,7 @@ |
| 16 | 16 | #import "LVCAnimationManager.h" |
| 17 | 17 | #import "chatListCell.h" |
| 18 | 18 | #import "chatMsgModel.h" |
| 19 | +#import "TopToolView.h" | |
| 19 | 20 | |
| 20 | 21 | #define BottomToolHeight 60 |
| 21 | 22 | |
| ... | ... | @@ -25,17 +26,23 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 25 | 26 | PopTypePriMessage //私信弹窗 |
| 26 | 27 | }; |
| 27 | 28 | |
| 28 | -@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource> | |
| 29 | +@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate> | |
| 29 | 30 | |
| 30 | -@property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; | |
| 31 | -@property (nonatomic ,strong ,readwrite) UIView * _Nullable animationBaseView;//展示层View | |
| 32 | -@property (nonatomic ,strong ) BottomToolView* _Nullable bottomToolView; | |
| 33 | -@property (nonatomic ,strong ) UIButton * _Nullable closeBtn; | |
| 34 | -@property (nonatomic ,strong ) UIView * _Nullable giftPopView; | |
| 35 | -@property (nonatomic ,strong ,readwrite) PresentView * _Nullable presentView;//连击View | |
| 31 | +@property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; | |
| 32 | +@property (nonatomic ,strong ,readwrite) UIView * _Nullable animationBaseView;//展示层View | |
| 33 | +@property (nonatomic ,strong ) BottomToolView* _Nullable bottomToolView; | |
| 34 | +@property (nonatomic ,strong ) UIButton * _Nullable closeBtn; | |
| 35 | +@property (nonatomic ,strong ) GiftListView * _Nullable giftListView; | |
| 36 | +@property (nonatomic ,weak ) UIView * _Nullable giftPopView; | |
| 37 | +@property (nonatomic ,strong ,readwrite) PresentView * _Nullable presentView;//连击View | |
| 36 | 38 | @property (nonatomic ,assign ) PopType popType; |
| 37 | -@property (nonatomic ,strong) UITableView * _Nullable chatTableView; | |
| 38 | -@property (nonatomic ,strong) NSMutableArray * _Nullable chatMsgArray;//聊天消息数组 | |
| 39 | +@property (nonatomic ,strong ) UITableView * _Nullable chatTableView; | |
| 40 | +@property (nonatomic ,strong ) NSMutableArray * _Nullable chatMsgArray;//聊天消息数组 | |
| 41 | +@property (nonatomic ,strong ) TopToolView * _Nullable topToolsView; | |
| 42 | +@property (nonatomic ,strong ) UIView * _Nullable commentsView; | |
| 43 | +@property (nonatomic ,strong ) UITextField * _Nullable commentText; | |
| 44 | +@property (nonatomic ,assign ) CGFloat offsetHeight; | |
| 45 | +@property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; | |
| 39 | 46 | |
| 40 | 47 | @end |
| 41 | 48 | |
| ... | ... | @@ -52,26 +59,119 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 52 | 59 | [self addSubview:self.closeBtn]; |
| 53 | 60 | [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureClick:)]]; |
| 54 | 61 | [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView speed:1]; |
| 55 | -// ChatView *chatView = [[ChatView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 150, 200, 100)]; | |
| 56 | -// chatView.backgroundColor = ZXRandomColor; | |
| 57 | -// [self addSubview:chatView]; | |
| 62 | + | |
| 58 | 63 | [self.animationBaseView addSubview:self.chatTableView]; |
| 59 | - self.chatTableView.backgroundColor = ZXRandomColor; | |
| 60 | - chatMsgModel *model = [[chatMsgModel alloc] init]; | |
| 61 | - model.name = @"张旭"; | |
| 62 | - [self.chatMsgArray addObject:model]; | |
| 64 | + self.chatTableView.backgroundColor = [UIColor whiteColor]; | |
| 65 | + self.chatTableView.alpha = 0.7; | |
| 66 | + | |
| 67 | + [self.animationBaseView addSubview:self.topToolsView]; | |
| 68 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | |
| 69 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil]; | |
| 70 | + | |
| 71 | + [CNLiveChatManager sharedCNLiveChatManager].delegate = self; | |
| 72 | + [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"123" messageCount:50 success:^(NSString *targetId) { | |
| 73 | + NSLog(@"success"); | |
| 74 | + } error:^(CNLiveChatErrorCode errors, NSString *targetId) { | |
| 75 | + NSLog(@"error"); | |
| 76 | + }]; | |
| 77 | + | |
| 78 | + [CNLiveChatManager sharedCNLiveChatManager].currentUserInfo.portraitUri = @"http://b.hiphotos.baidu.com/zhidao/wh%3D450%2C600/sign=f0c5c08030d3d539c16807c70fb7c566/8ad4b31c8701a18bbef9f231982f07082838feba.jpg"; | |
| 63 | 79 | } |
| 64 | 80 | return self; |
| 65 | 81 | } |
| 66 | 82 | |
| 67 | -#pragma mark - bottomBtnDelegate | |
| 68 | -- (void)bottomActionWithType:(BtnClickType)btnType | |
| 83 | +- (void)keyboardWillShow:(NSNotification *)notify { | |
| 84 | + | |
| 85 | + NSDictionary *userInfo = notify.userInfo; | |
| 86 | + CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame | |
| 87 | + [UIView animateWithDuration:0.25 animations:^{ | |
| 88 | + self.animationBaseView.top = - newFrameKeyboard.size.height + self.bottomToolView.height; | |
| 89 | + }]; | |
| 90 | + self.bottomToolView.hidden = YES; | |
| 91 | +} | |
| 92 | + | |
| 93 | +- (void)keyboardWillHidden:(NSNotification *)notify { | |
| 94 | + | |
| 95 | + [UIView animateWithDuration:0.1 animations:^{ | |
| 96 | + self.animationBaseView.top = 0; | |
| 97 | + [self.animationBaseView setNeedsDisplay]; | |
| 98 | + }]; | |
| 99 | + self.bottomToolView.hidden = NO; | |
| 100 | +} | |
| 101 | + | |
| 102 | +- (void)createCommentsView { | |
| 103 | + if (!_commentsView) { | |
| 104 | + | |
| 105 | + _commentsView = [[UIView alloc] initWithFrame:CGRectMake(0.0, SCREEN_HEIGHT - 340.0, SCREEN_WIDTH, 40.0)]; | |
| 106 | + _commentsView.backgroundColor = [UIColor clearColor]; | |
| 107 | + | |
| 108 | + UIImageView *bgView = [[UIImageView alloc] initWithFrame:_commentsView.bounds]; | |
| 109 | + bgView.image = [[UIImage imageNamed:@"textInputBgColor"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0) resizingMode:UIImageResizingModeStretch]; | |
| 110 | + bgView.alpha = 0.6; | |
| 111 | + bgView.userInteractionEnabled = YES; | |
| 112 | + [_commentsView addSubview:bgView]; | |
| 113 | + | |
| 114 | + _barrageSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(10, 10, 40, 30)]; | |
| 115 | + _barrageSwitch.tintColor = [UIColor orangeColor]; | |
| 116 | + _barrageSwitch.onTintColor = [UIColor orangeColor]; | |
| 117 | + _barrageSwitch.thumbTintColor = [UIColor lightGrayColor]; | |
| 118 | + _barrageSwitch.centerY = _commentsView.height * 0.5; | |
| 119 | + [bgView addSubview:_barrageSwitch]; | |
| 120 | + | |
| 121 | + UIButton *sendBtn = [[UIButton alloc] initWithFrame:CGRectMake(_commentsView.width - 80, 0, 80, _commentsView.height)]; | |
| 122 | + [sendBtn addTarget:self action:@selector(sendClick) forControlEvents:UIControlEventTouchUpInside]; | |
| 123 | + [sendBtn setTitle:@"发送" forState:UIControlStateNormal]; | |
| 124 | + [sendBtn setTitleColor:[UIColor cyanColor] forState:UIControlStateNormal]; | |
| 125 | + [bgView addSubview:sendBtn]; | |
| 126 | + | |
| 127 | + _commentText = [[UITextField alloc] initWithFrame:CGRectMake(_barrageSwitch.right + 20, 5, _commentsView.width - _barrageSwitch.right - 20 - 100, _commentsView.height - 10)]; | |
| 128 | + _commentText.layer.borderColor = [UIColor blueColor].CGColor; | |
| 129 | + _commentText.layer.borderWidth = 1.0; | |
| 130 | + _commentText.layer.cornerRadius = 2.0; | |
| 131 | + _commentText.layer.masksToBounds = YES; | |
| 132 | + _commentText.inputAccessoryView = _commentsView; | |
| 133 | + _commentText.backgroundColor = [UIColor clearColor]; | |
| 134 | + _commentText.returnKeyType = UIReturnKeySend; | |
| 135 | + _commentText.delegate = self; | |
| 136 | + _commentText.font = [UIFont systemFontOfSize:15.0]; | |
| 137 | + [bgView addSubview:_commentText]; | |
| 138 | + } | |
| 139 | + [[[UIApplication sharedApplication]keyWindow] addSubview:_commentsView];//添加到window上,在视图以外 | |
| 140 | + [_commentText becomeFirstResponder]; | |
| 141 | +} | |
| 142 | + | |
| 143 | +- (void)showCommentText { | |
| 144 | + [self createCommentsView]; | |
| 145 | + [_commentText becomeFirstResponder];//再次让textView成为第一响应者 | |
| 146 | +} | |
| 147 | + | |
| 148 | +#pragma mark - UITextFieldDelegate | |
| 149 | +- (BOOL)textFieldShouldReturn:(UITextField *)textField | |
| 150 | +{ | |
| 151 | + if (![textField.text isEqualToString:@""]) { | |
| 152 | + //send message | |
| 153 | + NSLog(@"send message"); | |
| 154 | + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:textField.text type:CNLive_ConversationType_CHATROOM targetId:@"123" success:^(CNLiveChatMessage *message) { | |
| 155 | + NSLog(@"msgid:%@,tagid:%@,content:%@",message.messageId,message.targetId,message.messageContent); | |
| 156 | + } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | |
| 157 | + NSLog(@"%@",messageId); | |
| 158 | + }]; | |
| 159 | + textField.text = @""; | |
| 160 | + } | |
| 161 | + [textField resignFirstResponder]; | |
| 162 | + return YES; | |
| 163 | +} | |
| 164 | + | |
| 165 | +#pragma mark - bottomBtnActionDelegate | |
| 166 | +- (void)bottomActionWithType:(BtnClickType)btnType button:(UIButton *)button | |
| 69 | 167 | { |
| 70 | 168 | switch (btnType) { |
| 71 | 169 | case BtnClickTypeChat: |
| 72 | 170 | { |
| 73 | 171 | self.popType = PopTypeChat; |
| 74 | 172 | |
| 173 | + [self showCommentText]; | |
| 174 | + [[LVCAnimationManager shareManager] suspend]; | |
| 75 | 175 | } |
| 76 | 176 | break; |
| 77 | 177 | case BtnClickTypePriChat: |
| ... | ... | @@ -82,19 +182,11 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 82 | 182 | case BtnClickTypeGift: |
| 83 | 183 | { |
| 84 | 184 | self.popType = PopTypeGift; |
| 185 | + [[LVCAnimationManager shareManager] suspend]; | |
| 85 | 186 | [self hiddenView:YES]; |
| 86 | - GiftListView *giftListView = [[GiftListView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 250, SCREEN_WIDTH, 250) liveBaseView:self]; | |
| 87 | - [self addSubview:giftListView]; | |
| 88 | - self.giftPopView = giftListView; | |
| 89 | - | |
| 90 | - UIImageView *giftBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, giftListView.width, giftListView.height)]; | |
| 91 | - giftBg.image = [UIImage imageNamed:@"背景400x300"]; | |
| 92 | - giftBg.centerX = giftListView.width * 0.5; | |
| 93 | - giftBg.centerY = giftListView.height * 0.5; | |
| 94 | - giftBg.alpha = 0.4; | |
| 95 | - [giftListView addSubview:giftBg]; | |
| 96 | - | |
| 97 | - | |
| 187 | + [self addSubview:self.giftListView]; | |
| 188 | + self.giftListView.frame = CGRectMake(0, SCREEN_HEIGHT - 250, SCREEN_WIDTH, 250); | |
| 189 | + self.giftPopView = _giftListView; | |
| 98 | 190 | } |
| 99 | 191 | break; |
| 100 | 192 | default: |
| ... | ... | @@ -109,6 +201,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 109 | 201 | self.chatTableView.hidden = isHidden; |
| 110 | 202 | } |
| 111 | 203 | |
| 204 | +/** | |
| 205 | + 清除当前pop的弹窗 | |
| 206 | + */ | |
| 112 | 207 | - (void)clearCurrentPopView |
| 113 | 208 | { |
| 114 | 209 | switch (self.popType) { |
| ... | ... | @@ -118,14 +213,15 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 118 | 213 | |
| 119 | 214 | self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); |
| 120 | 215 | [self hiddenView:NO]; |
| 216 | + [[LVCAnimationManager shareManager] resume]; | |
| 121 | 217 | } completion:^(BOOL finished) { |
| 122 | - [self.giftPopView removeFromSuperview]; | |
| 123 | 218 | }]; |
| 124 | 219 | } |
| 125 | 220 | break; |
| 126 | 221 | case PopTypeChat: |
| 127 | 222 | { |
| 128 | - | |
| 223 | + [self.commentText resignFirstResponder]; | |
| 224 | + [[LVCAnimationManager shareManager] resume]; | |
| 129 | 225 | } |
| 130 | 226 | break; |
| 131 | 227 | case PopTypePriMessage: |
| ... | ... | @@ -136,8 +232,84 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 136 | 232 | default: |
| 137 | 233 | break; |
| 138 | 234 | } |
| 139 | - | |
| 140 | 235 | } |
| 236 | + | |
| 237 | + | |
| 238 | +#pragma mark - buttonClick触摸屏幕关闭方法 | |
| 239 | +- (void)tapGestureClick:(UITapGestureRecognizer *)gesture | |
| 240 | +{ | |
| 241 | + [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView]; | |
| 242 | + [self clearCurrentPopView]; | |
| 243 | +} | |
| 244 | + | |
| 245 | +- (void)closeAction | |
| 246 | +{ | |
| 247 | + [self.viewController.navigationController popViewControllerAnimated:YES]; | |
| 248 | +} | |
| 249 | + | |
| 250 | +- (void)sendClick | |
| 251 | +{ | |
| 252 | + [self textFieldShouldReturn:self.commentText]; | |
| 253 | +} | |
| 254 | + | |
| 255 | +#pragma mark - userDetailDelegate聊天室列表个人信息 | |
| 256 | +- (void)userClickWithModel:(chatMsgModel *)model | |
| 257 | +{ | |
| 258 | + NSLog(@"点击人:%@",model.name); | |
| 259 | +} | |
| 260 | + | |
| 261 | +#pragma mark - CNLiveChatManagerDelegate | |
| 262 | +/** | |
| 263 | + 连接状态的的监听器 | |
| 264 | + | |
| 265 | + @param status 网络连接状态码 | |
| 266 | + */ | |
| 267 | +- (void)onConnectionStatusChanged:(CNLiveConnectionStatus)status | |
| 268 | +{ | |
| 269 | + NSLog(@"onConnectionStatusChanged"); | |
| 270 | +} | |
| 271 | + | |
| 272 | +/** | |
| 273 | + 加入聊天室成功的监听 | |
| 274 | + @param chatroomId 聊天室ID | |
| 275 | + */ | |
| 276 | +- (void)onChatRoomJoined:(NSString *)chatroomId | |
| 277 | +{ | |
| 278 | + NSLog(@"onChatRoomJoined"); | |
| 279 | +} | |
| 280 | + | |
| 281 | +/*! | |
| 282 | + 加入聊天室失败的监听 | |
| 283 | + | |
| 284 | + @param chatroomId 聊天室ID | |
| 285 | + @param errorCode 加入失败的错误码 | |
| 286 | + | |
| 287 | + @discussion 如果错误码是CNLive_KICKED_FROM_CHATROOM或CNLive_CHATROOM_NOT_EXIST,则不会自动重新加入聊天室,App需要按照自己的逻辑处理。 | |
| 288 | + */ | |
| 289 | +- (void)onChatRoomJoinFailed:(NSString *)chatroomId | |
| 290 | + errorCode:(CNLiveChatErrorCode)errorCode | |
| 291 | +{ | |
| 292 | + NSLog(@"onChatRoomJoinFailed"); | |
| 293 | +} | |
| 294 | + | |
| 295 | +/** | |
| 296 | + 接收消息监听 | |
| 297 | + | |
| 298 | + @param message 消息实体类型对象(包括消息内容,消息ID,会话类型,目标ID,发送者的用户信息) | |
| 299 | + */ | |
| 300 | +- (void)onReceived:(CNLiveChatMessage *)message | |
| 301 | +{ | |
| 302 | + NSLog(@"onReceived msg:%@",message.messageContent); | |
| 303 | +} | |
| 304 | + | |
| 305 | +/** | |
| 306 | + 当前用户在其他设备上登录,此设备被踢下线。 | |
| 307 | + */ | |
| 308 | +- (void)kickedByAnotherDevice | |
| 309 | +{ | |
| 310 | + NSLog(@"kickedByAnotherDevice"); | |
| 311 | +} | |
| 312 | + | |
| 141 | 313 | #pragma mark - 聊天消息列表 |
| 142 | 314 | #pragma mark - UITableViewDataSource |
| 143 | 315 | |
| ... | ... | @@ -149,6 +321,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 149 | 321 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath |
| 150 | 322 | { |
| 151 | 323 | chatListCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([chatListCell class]) forIndexPath:indexPath]; |
| 324 | + cell.delegate = self; | |
| 152 | 325 | [cell loadUIWithModel:self.chatMsgArray[indexPath.row]]; |
| 153 | 326 | return cell; |
| 154 | 327 | } |
| ... | ... | @@ -183,18 +356,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 183 | 356 | NSLog(@"%@礼物的连送动画执行完成", model.giftName); |
| 184 | 357 | } |
| 185 | 358 | |
| 186 | -#pragma mark - buttonClick | |
| 187 | -- (void)tapGestureClick:(UITapGestureRecognizer *)gesture | |
| 188 | -{ | |
| 189 | - [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView]; | |
| 190 | - [self clearCurrentPopView]; | |
| 191 | -} | |
| 192 | - | |
| 193 | -- (void)closeAction | |
| 194 | -{ | |
| 195 | - [self.viewController.navigationController popViewControllerAnimated:YES]; | |
| 196 | -} | |
| 197 | - | |
| 198 | 359 | #pragma mark - UIScrollViewDelegate |
| 199 | 360 | - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView |
| 200 | 361 | { |
| ... | ... | @@ -247,6 +408,15 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 247 | 408 | return _presentView; |
| 248 | 409 | } |
| 249 | 410 | |
| 411 | +- (UISwitch *)barrageSwitch | |
| 412 | +{ | |
| 413 | + if (!_barrageSwitch) | |
| 414 | + { | |
| 415 | + _barrageSwitch = [[UISwitch alloc] init]; | |
| 416 | + } | |
| 417 | + return _barrageSwitch; | |
| 418 | +} | |
| 419 | + | |
| 250 | 420 | - (BottomToolView *)bottomToolView |
| 251 | 421 | { |
| 252 | 422 | if (!_bottomToolView) |
| ... | ... | @@ -259,6 +429,15 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 259 | 429 | return _bottomToolView; |
| 260 | 430 | } |
| 261 | 431 | |
| 432 | +- (TopToolView *)topToolsView | |
| 433 | +{ | |
| 434 | + if (!_topToolsView) | |
| 435 | + { | |
| 436 | + _topToolsView = [[TopToolView alloc] initWithFrame:CGRectMake(10, 20, 150, 30)]; | |
| 437 | + _topToolsView.backgroundColor = ZXRandomColor; | |
| 438 | + } | |
| 439 | + return _topToolsView; | |
| 440 | +} | |
| 262 | 441 | - (UITableView *)chatTableView |
| 263 | 442 | { |
| 264 | 443 | if (!_chatTableView) { |
| ... | ... | @@ -279,7 +458,17 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 279 | 458 | - (NSMutableArray *)chatMsgArray |
| 280 | 459 | { |
| 281 | 460 | if (!_chatMsgArray) { |
| 461 | + | |
| 282 | 462 | _chatMsgArray = [NSMutableArray array]; |
| 463 | + NSArray *names = [NSArray arrayWithObjects:@"张旭",@"老大",@"老六",@"什么人",@"金光",@"银光",@"阳光", nil]; | |
| 464 | + NSArray *contents = [NSArray arrayWithObjects:@"阿萨德请问发群里发",@"阿萨德请问发群里发发染发我if顽皮的发球局平均分配WiF",@"阿萨德请问发群里发发染发我if顽皮的发球局平均分配WiFi我if为打破我姐夫我批发价为破房间我批发价我批发价为 爱神的箭怕我的哦期",@"里发发染发我if顽",@"金光神的箭怕我的哦期间",@"银光",@"阳光神的箭怕我的哦期间", nil]; | |
| 465 | + for (int i = 0 ; i < names.count; i ++) { | |
| 466 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | |
| 467 | + model.name = names[i]; | |
| 468 | + model.content = contents[i]; | |
| 469 | + model.cellWidth = self.chatTableView.width - 20; | |
| 470 | + [self.chatMsgArray addObject:model]; | |
| 471 | + } | |
| 283 | 472 | } |
| 284 | 473 | return _chatMsgArray; |
| 285 | 474 | } |
| ... | ... | @@ -298,6 +487,22 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 |
| 298 | 487 | return _closeBtn; |
| 299 | 488 | } |
| 300 | 489 | |
| 490 | +- (GiftListView *)giftListView | |
| 491 | +{ | |
| 492 | + if (!_giftListView) | |
| 493 | + { | |
| 494 | + _giftListView = [[GiftListView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 250, SCREEN_WIDTH, 250) liveBaseView:self]; | |
| 495 | + | |
| 496 | + UIImageView *giftBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, _giftListView.width, _giftListView.height)]; | |
| 497 | + giftBg.image = [UIImage imageNamed:@"背景400x300"]; | |
| 498 | + giftBg.centerX = _giftListView.width * 0.5; | |
| 499 | + giftBg.centerY = _giftListView.height * 0.5; | |
| 500 | + giftBg.alpha = 0.4; | |
| 501 | + [_giftListView addSubview:giftBg]; | |
| 502 | + } | |
| 503 | + return _giftListView; | |
| 504 | +} | |
| 505 | + | |
| 301 | 506 | /* |
| 302 | 507 | // Only override drawRect: if you perform custom drawing. |
| 303 | 508 | // An empty implementation adversely affects performance during animation. | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/TopToolView/TopToolView.h
0 → 100644
| 1 | +// | |
| 2 | +// TopToolView.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/21. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +@interface TopToolView : UIView | |
| 12 | + | |
| 13 | +- (instancetype)initWithFrame:(CGRect)frame isHost:(BOOL)isHost; | |
| 14 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/TopToolView/TopToolView.m
0 → 100644
| 1 | +// | |
| 2 | +// TopToolView.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/21. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "TopToolView.h" | |
| 10 | + | |
| 11 | +@implementation TopToolView | |
| 12 | + | |
| 13 | +- (instancetype)initWithFrame:(CGRect)frame isHost:(BOOL)isHost | |
| 14 | +{ | |
| 15 | + if (self = [super initWithFrame:frame]) { | |
| 16 | + | |
| 17 | + if (isHost) { | |
| 18 | + //主播端没有自己头像 | |
| 19 | + | |
| 20 | + | |
| 21 | + }else | |
| 22 | + {//观众端有主播头像 | |
| 23 | + | |
| 24 | + | |
| 25 | + } | |
| 26 | + } | |
| 27 | + return self; | |
| 28 | +} | |
| 29 | + | |
| 30 | +/* | |
| 31 | +// Only override drawRect: if you perform custom drawing. | |
| 32 | +// An empty implementation adversely affects performance during animation. | |
| 33 | +- (void)drawRect:(CGRect)rect { | |
| 34 | + // Drawing code | |
| 35 | +} | |
| 36 | +*/ | |
| 37 | + | |
| 38 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCUGCLivePlayerController.m
| ... | ... | @@ -46,6 +46,7 @@ |
| 46 | 46 | self.view.backgroundColor = [UIColor whiteColor]; |
| 47 | 47 | |
| 48 | 48 | [self.view addSubview:self.loadingView]; |
| 49 | + [self.view addSubview:self.bgView]; | |
| 49 | 50 | |
| 50 | 51 | //添加播放器通知 |
| 51 | 52 | [self installMovieNotificationObservers]; |
| ... | ... | @@ -187,6 +188,9 @@ |
| 187 | 188 | { |
| 188 | 189 | if (_player) { |
| 189 | 190 | NSLog(@"isPreparedToPlay"); |
| 191 | + if (_loadingView) { | |
| 192 | + [_loadingView removeFromSuperview]; | |
| 193 | + } | |
| 190 | 194 | } |
| 191 | 195 | } |
| 192 | 196 | |
| ... | ... | @@ -235,7 +239,7 @@ |
| 235 | 239 | // 获取主播状态通知 |
| 236 | 240 | - (void)anchorStatusChanged:(NSNotification *)notification |
| 237 | 241 | { |
| 238 | - if (_player.anchorStatus == 2) { | |
| 242 | + if (_player.anchorStatus == 2) { // 已结束 | |
| 239 | 243 | |
| 240 | 244 | } |
| 241 | 245 | _bgView.anchorStatus = _player.anchorStatus; |
| ... | ... | @@ -249,12 +253,23 @@ |
| 249 | 253 | |
| 250 | 254 | #pragma mark - getter |
| 251 | 255 | - (LVCUGCPlayerLoadingView *)loadingView { |
| 256 | + | |
| 252 | 257 | if (!_loadingView) { |
| 253 | 258 | _loadingView = [[LVCUGCPlayerLoadingView alloc] initWithFrame:self.view.bounds bgImageURLStr:@""]; |
| 254 | 259 | } |
| 255 | 260 | return _loadingView; |
| 256 | 261 | } |
| 257 | 262 | |
| 263 | +- (LVCUGCBackgroundView *)bgView { | |
| 264 | + | |
| 265 | + if (!_bgView) { | |
| 266 | + _bgView = [[LVCUGCBackgroundView alloc] init]; | |
| 267 | + _bgView.backgroundColor = [UIColor whiteColor]; | |
| 268 | + _bgView.hidden = YES; | |
| 269 | + } | |
| 270 | + return _bgView; | |
| 271 | +} | |
| 272 | + | |
| 258 | 273 | #pragma mark - 内存警告 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 259 | 274 | - (void)didReceiveMemoryWarning { |
| 260 | 275 | [super didReceiveMemoryWarning]; | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCUGCBackgroundView.m
| ... | ... | @@ -8,14 +8,102 @@ |
| 8 | 8 | |
| 9 | 9 | #import "LVCUGCBackgroundView.h" |
| 10 | 10 | |
| 11 | +@interface LVCUGCBackgroundView() | |
| 12 | + | |
| 13 | +@property (nonatomic, strong) UIImageView *iconView; | |
| 14 | + | |
| 15 | +@property (nonatomic, strong) UILabel *nicknameLabel; | |
| 16 | + | |
| 17 | +@property (nonatomic, strong) UILabel *playInfoLabel; | |
| 18 | + | |
| 19 | +@property (nonatomic, strong) UIButton *backButton; | |
| 20 | + | |
| 21 | +@end | |
| 22 | + | |
| 11 | 23 | @implementation LVCUGCBackgroundView |
| 12 | 24 | |
| 13 | -/* | |
| 14 | -// Only override drawRect: if you perform custom drawing. | |
| 15 | -// An empty implementation adversely affects performance during animation. | |
| 16 | -- (void)drawRect:(CGRect)rect { | |
| 17 | - // Drawing code | |
| 25 | + | |
| 26 | +- (instancetype)initWithFrame:(CGRect)frame | |
| 27 | +{ | |
| 28 | + self = [super initWithFrame:frame]; | |
| 29 | + if (self) { | |
| 30 | + [self addSubview:self.iconView]; | |
| 31 | + [self addSubview:self.nicknameLabel]; | |
| 32 | + [self addSubview:self.playInfoLabel]; | |
| 33 | + [self addSubview:self.backButton]; | |
| 34 | + } | |
| 35 | + return self; | |
| 36 | +} | |
| 37 | + | |
| 38 | +#pragma mark - setter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 39 | +- (void)setAnchorStatus:(int)anchorStatus | |
| 40 | +{ | |
| 41 | + switch (anchorStatus) { | |
| 42 | + case 0: | |
| 43 | + self.hidden = YES; | |
| 44 | + break; | |
| 45 | + | |
| 46 | + case 1: | |
| 47 | + _playInfoLabel.text = @"主播已离开,马上回来~"; | |
| 48 | + self.hidden = NO; | |
| 49 | + break; | |
| 50 | + | |
| 51 | + case 2: | |
| 52 | + _playInfoLabel.text = @"直播已结束"; | |
| 53 | + self.hidden = NO; | |
| 54 | + break; | |
| 55 | + | |
| 56 | + default: | |
| 57 | + break; | |
| 58 | + } | |
| 18 | 59 | } |
| 19 | -*/ | |
| 20 | 60 | |
| 61 | +#pragma mark - getter !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
| 62 | + | |
| 63 | +- (UIImageView *)iconView { | |
| 64 | + | |
| 65 | + if (!_iconView) { | |
| 66 | + NSString *path = [[NSBundle mainBundle] pathForResource:@"头像" ofType:@"jpg"]; | |
| 67 | + UIImage *image = [UIImage imageWithContentsOfFile:path]; | |
| 68 | + _iconView = [[UIImageView alloc] initWithImage:image]; | |
| 69 | + _iconView.frame = CGRectMake((SCREEN_WIDTH - 100) * 0.5, 200, 100, 100); | |
| 70 | + _iconView.layer.cornerRadius = 50; | |
| 71 | + _iconView.layer.masksToBounds = YES; | |
| 72 | + } | |
| 73 | + return _iconView; | |
| 74 | +} | |
| 75 | + | |
| 76 | +- (UILabel *)nicknameLabel { | |
| 77 | + | |
| 78 | + if (!_nicknameLabel) { | |
| 79 | + _nicknameLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 100) * 0.5, 310, 100, 30)]; | |
| 80 | + _nicknameLabel.textAlignment = NSTextAlignmentCenter; | |
| 81 | + _nicknameLabel.text = @"奥斯卡大家发你看"; | |
| 82 | + } | |
| 83 | + return _nicknameLabel; | |
| 84 | +} | |
| 85 | + | |
| 86 | +- (UILabel *)playInfoLabel { | |
| 87 | + | |
| 88 | + if (!_playInfoLabel) { | |
| 89 | + _playInfoLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 100) * 0.5, 350, 100, 50)]; | |
| 90 | + _playInfoLabel.textAlignment = NSTextAlignmentCenter; | |
| 91 | + _playInfoLabel.font = [UIFont systemFontOfSize:18]; | |
| 92 | + } | |
| 93 | + return _playInfoLabel; | |
| 94 | +} | |
| 95 | + | |
| 96 | +- (UIButton *)backButton { | |
| 97 | + | |
| 98 | + if (!_backButton) { | |
| 99 | + _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 100 | + _backButton.frame = CGRectMake((SCREEN_WIDTH - 200) * 0.5, 410, 200, 40); | |
| 101 | + _backButton.layer.cornerRadius = 20; | |
| 102 | + _backButton.layer.masksToBounds = YES; | |
| 103 | + _backButton.titleLabel.text = @"返回列表"; | |
| 104 | + _backButton.titleLabel.textAlignment = NSTextAlignmentCenter; | |
| 105 | + _backButton.titleLabel.font = [UIFont systemFontOfSize:18]; | |
| 106 | + } | |
| 107 | + return _backButton; | |
| 108 | +} | |
| 21 | 109 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/PrefixHeader.pch
LiveVideoCloud/LiveVideoCloud/Resource/Images/头像.jpg
0 → 100644
4.88 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/Contents.json
0 → 100644
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/textInputBgColor.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "textInputBgColor.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + }, | |
| 21 | + "properties" : { | |
| 22 | + "template-rendering-intent" : "original" | |
| 23 | + } | |
| 24 | +} | |
| 0 | 25 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/textInputBgColor.imageset/textInputBgColor.png
0 → 100644
1014 Bytes