Commit 57e31e4a09e5177ee1f921fc54db45689c4a3c3c
1 parent
f325df79
私聊页面
Showing
17 changed files
with
544 additions
and
241 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| @@ -127,7 +127,6 @@ | @@ -127,7 +127,6 @@ | ||
| 127 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CF21E6EAE2E0027CD92 /* Foundation+Log.m */; }; | 127 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CF21E6EAE2E0027CD92 /* Foundation+Log.m */; }; |
| 128 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CFE1E6EAE2E0027CD92 /* ZXServerUrl.m */; }; | 128 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CFE1E6EAE2E0027CD92 /* ZXServerUrl.m */; }; |
| 129 | D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029D151E6EB00D0027CD92 /* AppDelegate.m */; }; | 129 | D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029D151E6EB00D0027CD92 /* AppDelegate.m */; }; |
| 130 | - D207BE9E1E84BD68006A0CE8 /* BarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */; }; | ||
| 131 | D207BEA11E84C1EC006A0CE8 /* AnimationBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */; }; | 130 | D207BEA11E84C1EC006A0CE8 /* AnimationBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */; }; |
| 132 | D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2471E7B76C7003B44CB /* PresentView.m */; }; | 131 | D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2471E7B76C7003B44CB /* PresentView.m */; }; |
| 133 | D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2491E7B76C7003B44CB /* PresentViewCell.m */; }; | 132 | D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2491E7B76C7003B44CB /* PresentViewCell.m */; }; |
| @@ -179,6 +178,7 @@ | @@ -179,6 +178,7 @@ | ||
| 179 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; | 178 | D2888DB11E6EC05F003A77C8 /* TempViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB01E6EC05F003A77C8 /* TempViewController.m */; }; |
| 180 | D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; | 179 | D2888DB41E6EC154003A77C8 /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB31E6EC154003A77C8 /* HomeViewController.m */; }; |
| 181 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; }; | 180 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */; }; |
| 181 | + D29E81ED1E88DC5B008C9906 /* PriChatCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D29E81EC1E88DC5B008C9906 /* PriChatCell.m */; }; | ||
| 182 | D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; }; | 182 | D2A803081E80BD6F009D6F1C /* TopToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A803071E80BD6F009D6F1C /* TopToolView.m */; }; |
| 183 | D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; }; | 183 | D2B7B2511E8247D400ED084E /* ChatBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2501E8247D400ED084E /* ChatBarrageManager.m */; }; |
| 184 | D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; }; | 184 | D2B7B2541E824B2D00ED084E /* ChatBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D2B7B2531E824B2D00ED084E /* ChatBarrageView.m */; }; |
| @@ -476,8 +476,6 @@ | @@ -476,8 +476,6 @@ | ||
| 476 | D2029CFF1E6EAE2E0027CD92 /* UtilKits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilKits.h; sourceTree = "<group>"; }; | 476 | D2029CFF1E6EAE2E0027CD92 /* UtilKits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilKits.h; sourceTree = "<group>"; }; |
| 477 | D2029D121E6EAF8D0027CD92 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; | 477 | D2029D121E6EAF8D0027CD92 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; |
| 478 | D2029D151E6EB00D0027CD92 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; | 478 | D2029D151E6EB00D0027CD92 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; |
| 479 | - D207BE9C1E84BD68006A0CE8 /* BarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarrageManager.h; sourceTree = "<group>"; }; | ||
| 480 | - D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarrageManager.m; sourceTree = "<group>"; }; | ||
| 481 | D207BE9F1E84C1EC006A0CE8 /* AnimationBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationBaseView.h; sourceTree = "<group>"; }; | 479 | D207BE9F1E84C1EC006A0CE8 /* AnimationBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimationBaseView.h; sourceTree = "<group>"; }; |
| 482 | D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimationBaseView.m; sourceTree = "<group>"; }; | 480 | D207BEA01E84C1EC006A0CE8 /* AnimationBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimationBaseView.m; sourceTree = "<group>"; }; |
| 483 | D217A2451E7B76C7003B44CB /* PresentModelAble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentModelAble.h; sourceTree = "<group>"; }; | 481 | D217A2451E7B76C7003B44CB /* PresentModelAble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentModelAble.h; sourceTree = "<group>"; }; |
| @@ -566,6 +564,8 @@ | @@ -566,6 +564,8 @@ | ||
| 566 | D2888DB31E6EC154003A77C8 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; }; | 564 | D2888DB31E6EC154003A77C8 /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; }; |
| 567 | D2888DB51E6EC1B8003A77C8 /* LVCMyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMyViewController.h; sourceTree = "<group>"; }; | 565 | D2888DB51E6EC1B8003A77C8 /* LVCMyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCMyViewController.h; sourceTree = "<group>"; }; |
| 568 | D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; }; | 566 | D2888DB61E6EC1B8003A77C8 /* LVCMyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCMyViewController.m; sourceTree = "<group>"; }; |
| 567 | + D29E81EB1E88DC5B008C9906 /* PriChatCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PriChatCell.h; sourceTree = "<group>"; }; | ||
| 568 | + D29E81EC1E88DC5B008C9906 /* PriChatCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PriChatCell.m; sourceTree = "<group>"; }; | ||
| 569 | D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; }; | 569 | D2A803061E80BD6F009D6F1C /* TopToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopToolView.h; sourceTree = "<group>"; }; |
| 570 | D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; }; | 570 | D2A803071E80BD6F009D6F1C /* TopToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopToolView.m; sourceTree = "<group>"; }; |
| 571 | D2B7B24F1E8247D400ED084E /* ChatBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageManager.h; sourceTree = "<group>"; }; | 571 | D2B7B24F1E8247D400ED084E /* ChatBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatBarrageManager.h; sourceTree = "<group>"; }; |
| @@ -654,14 +654,6 @@ | @@ -654,14 +654,6 @@ | ||
| 654 | path = ../ChatView; | 654 | path = ../ChatView; |
| 655 | sourceTree = "<group>"; | 655 | sourceTree = "<group>"; |
| 656 | }; | 656 | }; |
| 657 | - 812E504D1E769995004F5FCD /* CNLiveSDK */ = { | ||
| 658 | - isa = PBXGroup; | ||
| 659 | - children = ( | ||
| 660 | - ); | ||
| 661 | - name = CNLiveSDK; | ||
| 662 | - path = LiveVideoCloud/Classes/CNLiveSDK; | ||
| 663 | - sourceTree = SOURCE_ROOT; | ||
| 664 | - }; | ||
| 665 | 812E504E1E7699B9004F5FCD /* CNLiveSDK */ = { | 657 | 812E504E1E7699B9004F5FCD /* CNLiveSDK */ = { |
| 666 | isa = PBXGroup; | 658 | isa = PBXGroup; |
| 667 | children = ( | 659 | children = ( |
| @@ -1263,15 +1255,6 @@ | @@ -1263,15 +1255,6 @@ | ||
| 1263 | path = AppDelegate; | 1255 | path = AppDelegate; |
| 1264 | sourceTree = "<group>"; | 1256 | sourceTree = "<group>"; |
| 1265 | }; | 1257 | }; |
| 1266 | - D207BE9B1E84BD3E006A0CE8 /* BarrageManager */ = { | ||
| 1267 | - isa = PBXGroup; | ||
| 1268 | - children = ( | ||
| 1269 | - D207BE9C1E84BD68006A0CE8 /* BarrageManager.h */, | ||
| 1270 | - D207BE9D1E84BD68006A0CE8 /* BarrageManager.m */, | ||
| 1271 | - ); | ||
| 1272 | - path = BarrageManager; | ||
| 1273 | - sourceTree = "<group>"; | ||
| 1274 | - }; | ||
| 1275 | D217A2441E7B76C7003B44CB /* Present */ = { | 1258 | D217A2441E7B76C7003B44CB /* Present */ = { |
| 1276 | isa = PBXGroup; | 1259 | isa = PBXGroup; |
| 1277 | children = ( | 1260 | children = ( |
| @@ -1298,7 +1281,6 @@ | @@ -1298,7 +1281,6 @@ | ||
| 1298 | D22830F61E77C26C00627701 /* Chat */ = { | 1281 | D22830F61E77C26C00627701 /* Chat */ = { |
| 1299 | isa = PBXGroup; | 1282 | isa = PBXGroup; |
| 1300 | children = ( | 1283 | children = ( |
| 1301 | - D207BE9B1E84BD3E006A0CE8 /* BarrageManager */, | ||
| 1302 | D2B7B24E1E8247B500ED084E /* ChatBarrageManager */, | 1284 | D2B7B24E1E8247B500ED084E /* ChatBarrageManager */, |
| 1303 | D236968F1E7FC83800E4BF71 /* ChatMsgModel */, | 1285 | D236968F1E7FC83800E4BF71 /* ChatMsgModel */, |
| 1304 | D22830F71E77C27A00627701 /* ChatViews */, | 1286 | D22830F71E77C27A00627701 /* ChatViews */, |
| @@ -1365,6 +1347,8 @@ | @@ -1365,6 +1347,8 @@ | ||
| 1365 | children = ( | 1347 | children = ( |
| 1366 | D24571611E83C40B00AA85D6 /* PrivateView.h */, | 1348 | D24571611E83C40B00AA85D6 /* PrivateView.h */, |
| 1367 | D24571621E83C40B00AA85D6 /* PrivateView.m */, | 1349 | D24571621E83C40B00AA85D6 /* PrivateView.m */, |
| 1350 | + D29E81EB1E88DC5B008C9906 /* PriChatCell.h */, | ||
| 1351 | + D29E81EC1E88DC5B008C9906 /* PriChatCell.m */, | ||
| 1368 | ); | 1352 | ); |
| 1369 | path = PrivateView; | 1353 | path = PrivateView; |
| 1370 | sourceTree = "<group>"; | 1354 | sourceTree = "<group>"; |
| @@ -1816,6 +1800,7 @@ | @@ -1816,6 +1800,7 @@ | ||
| 1816 | 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */, | 1800 | 810B65061E779B1F00133E15 /* View+MASAdditions.m in Sources */, |
| 1817 | D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */, | 1801 | D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */, |
| 1818 | D2029CB71E6EADE10027CD92 /* NSData+ImageContentType.m in Sources */, | 1802 | D2029CB71E6EADE10027CD92 /* NSData+ImageContentType.m in Sources */, |
| 1803 | + D29E81ED1E88DC5B008C9906 /* PriChatCell.m in Sources */, | ||
| 1819 | D2029CD01E6EADE10027CD92 /* SearchPresenter.m in Sources */, | 1804 | D2029CD01E6EADE10027CD92 /* SearchPresenter.m in Sources */, |
| 1820 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */, | 1805 | D2888DB71E6EC1B8003A77C8 /* LVCMyViewController.m in Sources */, |
| 1821 | D2029CBE1E6EADE10027CD92 /* SDWebImagePrefetcher.m in Sources */, | 1806 | D2029CBE1E6EADE10027CD92 /* SDWebImagePrefetcher.m in Sources */, |
| @@ -1897,7 +1882,6 @@ | @@ -1897,7 +1882,6 @@ | ||
| 1897 | D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */, | 1882 | D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */, |
| 1898 | D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */, | 1883 | D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */, |
| 1899 | D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, | 1884 | D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, |
| 1900 | - D207BE9E1E84BD68006A0CE8 /* BarrageManager.m in Sources */, | ||
| 1901 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */, | 1885 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */, |
| 1902 | D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, | 1886 | D2029D081E6EAE2E0027CD92 /* ZXDeviceInfo.m in Sources */, |
| 1903 | D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */, | 1887 | D24571631E83C40B00AA85D6 /* PrivateView.m in Sources */, |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/AnimationBaseView.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/BarrageManager/BarrageManager.h deleted
100644 → 0
| 1 | -// | ||
| 2 | -// BarrageManager.h | ||
| 3 | -// LiveVideoCloud | ||
| 4 | -// | ||
| 5 | -// Created by 张旭 on 2017/3/24. | ||
| 6 | -// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import <Foundation/Foundation.h> | ||
| 10 | -@class chatMsgModel; | ||
| 11 | -@class ChatBarrageView; | ||
| 12 | -#import "AnimationBaseView.h" | ||
| 13 | -@interface BarrageManager : NSObject <TouchPointDelegate> | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - 初始化管理类 | ||
| 17 | - @return 当前manager | ||
| 18 | - */ | ||
| 19 | -+ (instancetype)sharedManager; | ||
| 20 | - | ||
| 21 | -- (ChatBarrageView *)addAnimationWithModel:(chatMsgModel *)model animContentView:(UIView *)animContentView; | ||
| 22 | - | ||
| 23 | -@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/BarrageManager/BarrageManager.m deleted
100644 → 0
| 1 | -// | ||
| 2 | -// BarrageManager.m | ||
| 3 | -// LiveVideoCloud | ||
| 4 | -// | ||
| 5 | -// Created by 张旭 on 2017/3/24. | ||
| 6 | -// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | -// | ||
| 8 | - | ||
| 9 | -#import "BarrageManager.h" | ||
| 10 | -#import "chatMsgModel.h" | ||
| 11 | -#import "ChatBarrageView.h" | ||
| 12 | - | ||
| 13 | -@interface BarrageManager ()<CAAnimationDelegate> | ||
| 14 | - | ||
| 15 | -@property (nonatomic ,strong) NSTimer * _Nullable timer; | ||
| 16 | -@property (nonatomic ,strong) ChatBarrageView *_Nullable barrageView; | ||
| 17 | -@property (nonatomic ,strong) AnimationBaseView * _Nullable animBaseView; | ||
| 18 | -@property (nonatomic ,assign) CGRect barrCurrentRect; | ||
| 19 | - | ||
| 20 | -@end | ||
| 21 | -@implementation BarrageManager | ||
| 22 | - | ||
| 23 | -/** | ||
| 24 | - 初始化管理类 | ||
| 25 | - @return 当前manager | ||
| 26 | - */ | ||
| 27 | -+ (instancetype)sharedManager{ | ||
| 28 | - | ||
| 29 | - static BarrageManager *manager; | ||
| 30 | - | ||
| 31 | - static dispatch_once_t onceToken; | ||
| 32 | - dispatch_once(&onceToken, ^{ | ||
| 33 | - manager = [[BarrageManager alloc] init]; | ||
| 34 | - }); | ||
| 35 | - return manager; | ||
| 36 | -} | ||
| 37 | - | ||
| 38 | -//- (AnimationBaseView *)animBaseView | ||
| 39 | -//{ | ||
| 40 | -// if (!_animBaseView) | ||
| 41 | -// { | ||
| 42 | -// _animBaseView = [[AnimationBaseView alloc] init]; | ||
| 43 | -// } | ||
| 44 | -// return _animBaseView; | ||
| 45 | -//} | ||
| 46 | - | ||
| 47 | -/** | ||
| 48 | - 根据实际model添加动画 | ||
| 49 | - | ||
| 50 | - @param model modelobj | ||
| 51 | - */ | ||
| 52 | -- (ChatBarrageView *)addAnimationWithModel:(chatMsgModel *)model animContentView:(UIView *)animContentView | ||
| 53 | -{ | ||
| 54 | - ChatBarrageView *barrageView = [ChatBarrageView barrageViewWithPoint:CGPointMake(SCREEN_WIDTH + 50, 100)]; | ||
| 55 | - barrageView.backgroundColor = [UIColor blackColor]; | ||
| 56 | - [animContentView addSubview:barrageView]; | ||
| 57 | - self.barrageView = barrageView; | ||
| 58 | - self.animBaseView = (AnimationBaseView *)animContentView; | ||
| 59 | - | ||
| 60 | - barrageView.model = model; | ||
| 61 | - | ||
| 62 | - [self animationWithDuration:8 | ||
| 63 | - YValues:@[ @(SCREEN_WIDTH + 50), @(-(200))] | ||
| 64 | - keyTimes:@[@0.0, @1.0] | ||
| 65 | - timingFunctions:@[ | ||
| 66 | - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear], | ||
| 67 | - ] | ||
| 68 | - addView:barrageView]; | ||
| 69 | - [self createTimer]; | ||
| 70 | - self.animBaseView.isBarrage = YES; | ||
| 71 | - | ||
| 72 | -// [UIView animateWithDuration:10 animations:^{ | ||
| 73 | -// | ||
| 74 | -// barrageView.left = - 200; | ||
| 75 | -// } completion:^(BOOL finished) { | ||
| 76 | -// [self stopTimer]; | ||
| 77 | -// [barrageView removeFromSuperview]; | ||
| 78 | -// NSLog(@"finished"); | ||
| 79 | -// }]; | ||
| 80 | - return barrageView; | ||
| 81 | -} | ||
| 82 | - | ||
| 83 | -// 实时监测 ,也可以用循环定时器 | ||
| 84 | -- (void)createTimer{ | ||
| 85 | - if (!self.timer) { | ||
| 86 | - self.timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(jianCe) userInfo:nil repeats:YES]; | ||
| 87 | - } | ||
| 88 | -} | ||
| 89 | -- (void) jianCe{ | ||
| 90 | - CGRect rect = [[self.barrageView.layer presentationLayer ]frame]; // view指动画中移动的view | ||
| 91 | - self.barrCurrentRect = rect; | ||
| 92 | -// NSLog(@"箭%@",NSStringFromCGRect(rect)); | ||
| 93 | -} | ||
| 94 | - | ||
| 95 | -- (void)stopTimer | ||
| 96 | -{ | ||
| 97 | - if(self.timer) | ||
| 98 | - { | ||
| 99 | - [self.timer invalidate]; | ||
| 100 | - self.timer = nil; | ||
| 101 | - } | ||
| 102 | -} | ||
| 103 | - | ||
| 104 | -#pragma mark - touchPointDelegate | ||
| 105 | -- (void)touchPoint:(CGPoint)touchPoint | ||
| 106 | -{ | ||
| 107 | - CGFloat dxLeft = touchPoint.x - self.barrCurrentRect.origin.x;// >0 | ||
| 108 | - CGFloat dxRight = touchPoint.x - self.barrCurrentRect.origin.x - self.barrCurrentRect.size.width;// < 0 | ||
| 109 | - CGFloat dyLeft = touchPoint.y - self.barrCurrentRect.origin.y;// >0 | ||
| 110 | - CGFloat dyRight = touchPoint.y - self.barrCurrentRect.origin.y - self.barrCurrentRect.size.height;// <0 | ||
| 111 | - | ||
| 112 | - if (dxLeft > 0 && dxRight < 0 && dyLeft > 0 && dyRight < 0) { | ||
| 113 | - //在当前矩形区域内 | ||
| 114 | -// NSLog(@"在当前矩形区域内"); | ||
| 115 | - [self.barrageView barrageViewClickWithModel:self.barrageView.model]; | ||
| 116 | - }else | ||
| 117 | - { | ||
| 118 | -// NSLog(@"不在当前矩形区域内"); | ||
| 119 | - } | ||
| 120 | -} | ||
| 121 | - | ||
| 122 | -- (void)animationWithDuration:(float)duration YValues:(NSArray *)YValues keyTimes:(NSArray *)keyTimes timingFunctions:(NSArray *)timingFunctions addView:(UIView *)addView{ | ||
| 123 | - CAKeyframeAnimation *rocketAnim = [CAKeyframeAnimation animation]; | ||
| 124 | - rocketAnim.keyPath = @"position.x"; | ||
| 125 | - rocketAnim.values = YValues; | ||
| 126 | - rocketAnim.keyTimes = keyTimes; | ||
| 127 | - rocketAnim.timingFunctions = timingFunctions; | ||
| 128 | - rocketAnim.duration = duration; | ||
| 129 | - rocketAnim.fillMode = kCAFillModeForwards; | ||
| 130 | - rocketAnim.removedOnCompletion = NO; | ||
| 131 | - rocketAnim.delegate = self; | ||
| 132 | - [addView.layer addAnimation:rocketAnim forKey:@"positionY"]; | ||
| 133 | -} | ||
| 134 | - | ||
| 135 | -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{ | ||
| 136 | - NSLog(@"didStop"); | ||
| 137 | - [self stopTimer]; | ||
| 138 | - [self.barrageView removeFromSuperview]; | ||
| 139 | - self.animBaseView.isBarrage = NO; | ||
| 140 | -} | ||
| 141 | -@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatBarrageManager/ChatBarrageView.h
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | #import "ChatBarrageAnimAction.h" | 9 | #import "ChatBarrageAnimAction.h" |
| 10 | 10 | ||
| 11 | + | ||
| 11 | @class AnimationBaseView; | 12 | @class AnimationBaseView; |
| 12 | @class chatMsgModel; | 13 | @class chatMsgModel; |
| 13 | @interface ChatBarrageView : ChatBarrageAnimAction | 14 | @interface ChatBarrageView : ChatBarrageAnimAction |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.h
| @@ -21,4 +21,9 @@ | @@ -21,4 +21,9 @@ | ||
| 21 | @property (nonatomic) BOOL isMine;//消息是否是自己发送 | 21 | @property (nonatomic) BOOL isMine;//消息是否是自己发送 |
| 22 | @property (nonatomic ,copy) NSString * _Nullable ID;//唯一标识 | 22 | @property (nonatomic ,copy) NSString * _Nullable ID;//唯一标识 |
| 23 | 23 | ||
| 24 | +///// | ||
| 25 | +@property (nonatomic ,assign) CGFloat priCellHeight; | ||
| 26 | +@property (nonatomic ,assign) CGFloat priCellWidth; | ||
| 27 | + | ||
| 28 | + | ||
| 24 | @end | 29 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
| @@ -29,4 +29,22 @@ | @@ -29,4 +29,22 @@ | ||
| 29 | // NSLog(@"cellHeight = %f",_cellHeight); | 29 | // NSLog(@"cellHeight = %f",_cellHeight); |
| 30 | return _cellHeight; | 30 | return _cellHeight; |
| 31 | } | 31 | } |
| 32 | + | ||
| 33 | +- (CGFloat)priCellHeight | ||
| 34 | +{ | ||
| 35 | + //如果计算过高度,直接返回 | ||
| 36 | + if (_priCellHeight) return _priCellHeight; | ||
| 37 | + | ||
| 38 | + _priCellHeight = 0; | ||
| 39 | + NSString *content = self.content; | ||
| 40 | + //文字 | ||
| 41 | + CGFloat textMaxW = self.priCellWidth; | ||
| 42 | + CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT); | ||
| 43 | + CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14]} context:nil].size; | ||
| 44 | + | ||
| 45 | + //底部空隙 | ||
| 46 | + _priCellHeight += textSize.height + ChatCellMargin; | ||
| 47 | +// NSLog(@"pricellHeight = %f",_priCellHeight); | ||
| 48 | + return _priCellHeight; | ||
| 49 | +} | ||
| 32 | @end | 50 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| @@ -20,7 +20,6 @@ | @@ -20,7 +20,6 @@ | ||
| 20 | #import "ChatBarrageManager.h" | 20 | #import "ChatBarrageManager.h" |
| 21 | #import "userInfoModel.h" | 21 | #import "userInfoModel.h" |
| 22 | #import "PrivateView.h" | 22 | #import "PrivateView.h" |
| 23 | -//#import "BarrageManager.h" | ||
| 24 | #import "ChatBarrageView.h" | 23 | #import "ChatBarrageView.h" |
| 25 | #import "AnimationBaseView.h" | 24 | #import "AnimationBaseView.h" |
| 26 | 25 | ||
| @@ -35,7 +34,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -35,7 +34,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 35 | PopTypePriMessage //私信弹窗 | 34 | PopTypePriMessage //私信弹窗 |
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | -@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate> | 37 | +@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate,PopViewDelegate> |
| 39 | 38 | ||
| 40 | @property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; | 39 | @property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; |
| 41 | @property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View | 40 | @property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View |
| @@ -53,8 +52,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -53,8 +52,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 53 | @property (nonatomic ,assign ) CGFloat offsetHeight; | 52 | @property (nonatomic ,assign ) CGFloat offsetHeight; |
| 54 | @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; | 53 | @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; |
| 55 | @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; | 54 | @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; |
| 56 | -//@property (nonatomic ,strong ) BarrageManager * _Nullable barrManager; | ||
| 57 | - | ||
| 58 | @property (nonatomic ,strong) ChatBarrageView * _Nullable barrageView; | 55 | @property (nonatomic ,strong) ChatBarrageView * _Nullable barrageView; |
| 59 | 56 | ||
| 60 | @end | 57 | @end |
| @@ -251,9 +248,16 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -251,9 +248,16 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 251 | - (void)showPrivateView | 248 | - (void)showPrivateView |
| 252 | { | 249 | { |
| 253 | PrivateView *privateView = [PrivateView privateView]; | 250 | PrivateView *privateView = [PrivateView privateView]; |
| 254 | - privateView.backgroundColor = [UIColor yellowColor]; | 251 | + privateView.backgroundColor = [UIColor whiteColor]; |
| 255 | [self addSubview:privateView]; | 252 | [self addSubview:privateView]; |
| 253 | + privateView.delegate = self; | ||
| 256 | self.giftPopView = privateView; | 254 | self.giftPopView = privateView; |
| 255 | + | ||
| 256 | + [UIView animateWithDuration:0.5 animations:^{ | ||
| 257 | + privateView.top -= 300; | ||
| 258 | + } completion:^(BOOL finished) { | ||
| 259 | + | ||
| 260 | + }]; | ||
| 257 | } | 261 | } |
| 258 | 262 | ||
| 259 | - (void)hiddenView:(BOOL)isHidden | 263 | - (void)hiddenView:(BOOL)isHidden |
| @@ -288,12 +292,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -288,12 +292,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 288 | break; | 292 | break; |
| 289 | case PopTypePriMessage: | 293 | case PopTypePriMessage: |
| 290 | { | 294 | { |
| 291 | - [UIView animateWithDuration:0.25 animations:^{ | ||
| 292 | - | ||
| 293 | - self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); | ||
| 294 | - [self hiddenView:NO]; | ||
| 295 | - } completion:^(BOOL finished) { | ||
| 296 | - }]; | 295 | + if (((PrivateView *)self.giftPopView).isEditing) { |
| 296 | + //正在编辑 | ||
| 297 | + [(PrivateView *)self.giftPopView endCurrentEditing]; | ||
| 298 | + | ||
| 299 | + }else//已结束编辑 | ||
| 300 | + { | ||
| 301 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 302 | + | ||
| 303 | + self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 300); | ||
| 304 | + [self hiddenView:NO]; | ||
| 305 | + } completion:^(BOOL finished) { | ||
| 306 | + }]; | ||
| 307 | + } | ||
| 308 | + | ||
| 297 | } | 309 | } |
| 298 | break; | 310 | break; |
| 299 | default: | 311 | default: |
| @@ -345,6 +357,12 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -345,6 +357,12 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 345 | }]; | 357 | }]; |
| 346 | } | 358 | } |
| 347 | 359 | ||
| 360 | +#pragma mark - PriClosePopViewDelegate | ||
| 361 | +- (void)closeCurrentPopView | ||
| 362 | +{ | ||
| 363 | + [self clearCurrentPopView]; | ||
| 364 | +} | ||
| 365 | + | ||
| 348 | #pragma mark - CNLiveChatManagerDelegate | 366 | #pragma mark - CNLiveChatManagerDelegate |
| 349 | /** | 367 | /** |
| 350 | 连接状态的的监听器 | 368 | 连接状态的的监听器 |
| @@ -387,40 +405,70 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -387,40 +405,70 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 387 | - (void)onReceived:(CNLiveChatMessage *)message | 405 | - (void)onReceived:(CNLiveChatMessage *)message |
| 388 | { | 406 | { |
| 389 | // NSLog(@"onReceived"); | 407 | // NSLog(@"onReceived"); |
| 390 | - NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | ||
| 391 | - NSString *content = [JSONDic objectForKey:message_content]; | ||
| 392 | - | ||
| 393 | - //将消息显示到列表中 | ||
| 394 | - chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 395 | - model.name = message.userInfo.name; | ||
| 396 | - model.content = content; | ||
| 397 | - model.ID = message.targetId; | ||
| 398 | - model.icon = message.userInfo.portraitUri; | ||
| 399 | - model.cellWidth = self.chatTableView.width - 20; | ||
| 400 | - [self.chatMsgArray addObject:model]; | ||
| 401 | - [self.chatTableView reloadData]; | ||
| 402 | - | ||
| 403 | - NSInteger section = [self.chatTableView numberOfSections]; | ||
| 404 | - if (section < 1) return; | ||
| 405 | - NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 406 | - if (row < 1) return; | ||
| 407 | - NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 408 | - [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 409 | - [self.chatTableView reloadData]; | ||
| 410 | - | ||
| 411 | - NSInteger isBarrage = [[JSONDic objectForKey:message_barrage] integerValue]; | ||
| 412 | - | ||
| 413 | - if (isBarrage) {//此条消息飘弹幕 | ||
| 414 | - | ||
| 415 | - chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; | ||
| 416 | - barrageModel.name = message.userInfo.name; | ||
| 417 | - barrageModel.content = content; | ||
| 418 | - barrageModel.icon = message.userInfo.portraitUri; | ||
| 419 | -// self.barrageView = [self.barrManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; | ||
| 420 | - [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView];//self.barrageView = | 408 | + switch (message.conversationType) { |
| 409 | + case CNLive_ConversationType_CHATROOM: | ||
| 410 | + { | ||
| 411 | + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | ||
| 412 | + NSString *content = [JSONDic objectForKey:message_content]; | ||
| 413 | + | ||
| 414 | + //将消息显示到列表中 | ||
| 415 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 416 | + model.name = message.userInfo.name; | ||
| 417 | + model.content = content; | ||
| 418 | + model.ID = message.targetId; | ||
| 419 | + model.icon = message.userInfo.portraitUri; | ||
| 420 | + model.cellWidth = self.chatTableView.width - 20; | ||
| 421 | + [self.chatMsgArray addObject:model]; | ||
| 422 | + [self.chatTableView reloadData]; | ||
| 423 | + | ||
| 424 | + NSInteger section = [self.chatTableView numberOfSections]; | ||
| 425 | + if (section < 1) return; | ||
| 426 | + NSInteger row = [self.chatTableView numberOfRowsInSection:section - 1]; | ||
| 427 | + if (row < 1) return; | ||
| 428 | + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 429 | + [self.chatTableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 430 | + [self.chatTableView reloadData]; | ||
| 431 | + | ||
| 432 | + NSInteger isBarrage = [[JSONDic objectForKey:message_barrage] integerValue]; | ||
| 433 | + | ||
| 434 | + if (isBarrage) {//此条消息飘弹幕 | ||
| 435 | + | ||
| 436 | + chatMsgModel *barrageModel = [[chatMsgModel alloc] init]; | ||
| 437 | + barrageModel.name = message.userInfo.name; | ||
| 438 | + barrageModel.content = content; | ||
| 439 | + barrageModel.icon = message.userInfo.portraitUri; | ||
| 440 | + [self.chatManager addAnimationWithModel:barrageModel animContentView:self.animationBaseView]; | ||
| 441 | + } | ||
| 442 | + } | ||
| 443 | + break; | ||
| 444 | + case CNLive_ConversationType_PRIVATE: | ||
| 445 | + { | ||
| 446 | + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | ||
| 447 | + NSString *content = [JSONDic objectForKey:message_content]; | ||
| 448 | + PrivateView *privateView = [PrivateView privateView]; | ||
| 421 | 449 | ||
| 422 | - self.animationBaseView.delegate = self.chatManager; | ||
| 423 | -// self.animationBaseView.barrageView = self.barrageView; | 450 | + //将消息显示到列表中 |
| 451 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 452 | + model.name = message.userInfo.name; | ||
| 453 | + model.isMine = NO; | ||
| 454 | + model.content = content; | ||
| 455 | + model.ID = message.targetId; | ||
| 456 | + model.icon = message.userInfo.portraitUri; | ||
| 457 | + model.cellWidth = privateView.tableView.width - 20; | ||
| 458 | + [privateView.chatArray addObject:model]; | ||
| 459 | + [privateView.tableView reloadData]; | ||
| 460 | + | ||
| 461 | + NSInteger section = [privateView.tableView numberOfSections]; | ||
| 462 | + if (section < 1) return; | ||
| 463 | + NSInteger row = [privateView.tableView numberOfRowsInSection:section - 1]; | ||
| 464 | + if (row < 1) return; | ||
| 465 | + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 466 | + [privateView.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 467 | + [privateView.tableView reloadData]; | ||
| 468 | + } | ||
| 469 | + break; | ||
| 470 | + default: | ||
| 471 | + break; | ||
| 424 | } | 472 | } |
| 425 | } | 473 | } |
| 426 | 474 | ||
| @@ -629,14 +677,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -629,14 +677,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 629 | return _giftListView; | 677 | return _giftListView; |
| 630 | } | 678 | } |
| 631 | 679 | ||
| 632 | -//- (BarrageManager *)barrManager | ||
| 633 | -//{ | ||
| 634 | -// if (!_barrManager) | ||
| 635 | -// { | ||
| 636 | -// _barrManager = [BarrageManager sharedManager]; | ||
| 637 | -// } | ||
| 638 | -// return _barrManager; | ||
| 639 | -//} | ||
| 640 | - (ChatBarrageManager *)chatManager | 680 | - (ChatBarrageManager *)chatManager |
| 641 | { | 681 | { |
| 642 | if (!_chatManager) | 682 | if (!_chatManager) |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.m
0 → 100644
| 1 | +// | ||
| 2 | +// PriChatCell.m | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by 张旭 on 2017/3/27. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "PriChatCell.h" | ||
| 10 | +#import "chatMsgModel.h" | ||
| 11 | + | ||
| 12 | +#define CHAT_POP_WIDTH 260 | ||
| 13 | +#define TOP_MARGIN 6 | ||
| 14 | + | ||
| 15 | +@interface PriChatCell () | ||
| 16 | + | ||
| 17 | +@property (nonatomic ,strong) chatMsgModel * _Nullable model; | ||
| 18 | +@property (nonatomic ,strong) UIImageView * _Nullable icon; | ||
| 19 | +@property (nonatomic ,strong) UILabel * _Nullable content; | ||
| 20 | +@property (nonatomic ,strong) UIImageView * _Nullable bgImgView; | ||
| 21 | + | ||
| 22 | +@end | ||
| 23 | + | ||
| 24 | +@implementation PriChatCell | ||
| 25 | + | ||
| 26 | +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | ||
| 27 | +{ | ||
| 28 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | ||
| 29 | + if (self) { | ||
| 30 | + self.backgroundColor = [UIColor clearColor]; | ||
| 31 | + self.selectionStyle = UITableViewCellSelectionStyleNone; | ||
| 32 | + } | ||
| 33 | + return self; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +- (void)loadUIWithModel:(chatMsgModel *)model | ||
| 37 | +{ | ||
| 38 | + _model = model; | ||
| 39 | + [self bindView]; | ||
| 40 | + [self.icon sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil]; | ||
| 41 | + self.content.text = model.content; | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +- (void)bindView | ||
| 45 | +{ | ||
| 46 | + self.icon.frame = CGRectMake(self.width - 30, TOP_MARGIN, 25, 25); | ||
| 47 | +// NSLog(@"self.icon.centerY%f",self.height * 0.5);//13.353516 | ||
| 48 | + self.icon.top = 13.353516; | ||
| 49 | + self.content.frame = CGRectMake(self.width - 30 - CHAT_POP_WIDTH, TOP_MARGIN, CHAT_POP_WIDTH, self.height - 2 * TOP_MARGIN); | ||
| 50 | +// self.bgImgView.frame = CGRectMake(<#CGFloat x#>, <#CGFloat y#>, <#CGFloat width#>, <#CGFloat height#>); | ||
| 51 | + self.icon.backgroundColor = ZXRandomColor; | ||
| 52 | + self.content.backgroundColor = ZXRandomColor; | ||
| 53 | +} | ||
| 54 | + | ||
| 55 | +#pragma mark - getter | ||
| 56 | +- (UILabel * _Nullable)content | ||
| 57 | +{ | ||
| 58 | + if (!_content) | ||
| 59 | + { | ||
| 60 | + _content = [[UILabel alloc] init]; | ||
| 61 | + _content.textAlignment = NSTextAlignmentCenter; | ||
| 62 | + _content.textColor = [UIColor blackColor]; | ||
| 63 | + _content.numberOfLines = 0; | ||
| 64 | + _content.font = [UIFont systemFontOfSize:14.f]; | ||
| 65 | + [self addSubview:_content]; | ||
| 66 | + } | ||
| 67 | + return _content; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +- (UIImageView * _Nullable)icon | ||
| 71 | +{ | ||
| 72 | + if (!_icon) | ||
| 73 | + { | ||
| 74 | + _icon = [[UIImageView alloc] init]; | ||
| 75 | + _icon.layer.masksToBounds = YES; | ||
| 76 | + _icon.layer.cornerRadius = 15.f; | ||
| 77 | + [self addSubview:_icon]; | ||
| 78 | + } | ||
| 79 | + return _icon; | ||
| 80 | +} | ||
| 81 | + | ||
| 82 | +- (UIImageView * _Nullable)bgImgView | ||
| 83 | +{ | ||
| 84 | + if (!_bgImgView) | ||
| 85 | + { | ||
| 86 | + _bgImgView = [[UIImageView alloc] init]; | ||
| 87 | + [self addSubview:_bgImgView]; | ||
| 88 | + } | ||
| 89 | + return _bgImgView; | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +- (void)awakeFromNib { | ||
| 93 | + [super awakeFromNib]; | ||
| 94 | + // Initialization code | ||
| 95 | +} | ||
| 96 | + | ||
| 97 | +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { | ||
| 98 | + [super setSelected:selected animated:animated]; | ||
| 99 | + | ||
| 100 | + // Configure the view for the selected state | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.h
| @@ -8,8 +8,24 @@ | @@ -8,8 +8,24 @@ | ||
| 8 | 8 | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | 10 | ||
| 11 | + | ||
| 12 | +@protocol PopViewDelegate <NSObject> | ||
| 13 | + | ||
| 14 | +- (void)closeCurrentPopView; | ||
| 15 | + | ||
| 16 | +@end | ||
| 17 | + | ||
| 11 | @interface PrivateView : UIView | 18 | @interface PrivateView : UIView |
| 12 | 19 | ||
| 13 | -+ (instancetype)privateView; | 20 | ++ (instancetype _Nonnull)privateView; |
| 21 | + | ||
| 22 | +- (void)endCurrentEditing; | ||
| 23 | + | ||
| 24 | +@property (nonatomic ,assign) BOOL isEditing; | ||
| 25 | + | ||
| 26 | +@property (nonatomic ,strong) _Nonnull id <PopViewDelegate> delegate; | ||
| 27 | +@property (nonatomic ,strong) UITableView * _Nullable tableView; | ||
| 28 | + | ||
| 29 | +@property (nonatomic ,strong) NSMutableArray * _Nullable chatArray; | ||
| 14 | 30 | ||
| 15 | @end | 31 | @end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.m
| @@ -7,13 +7,245 @@ | @@ -7,13 +7,245 @@ | ||
| 7 | // | 7 | // |
| 8 | 8 | ||
| 9 | #import "PrivateView.h" | 9 | #import "PrivateView.h" |
| 10 | +#import "PriChatCell.h" | ||
| 11 | +#import "chatMsgModel.h" | ||
| 12 | + | ||
| 13 | +@interface PrivateView ()<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> | ||
| 14 | + | ||
| 15 | +@property (nonatomic ,strong) UILabel * _Nullable nameLbl; | ||
| 16 | +@property (nonatomic ,strong) UIButton * _Nullable closeBtn; | ||
| 17 | + | ||
| 18 | +@property (nonatomic ,strong) UIImageView * _Nullable bottomTool; | ||
| 19 | +@property (nonatomic ,strong) UIButton * _Nullable sendBtn; | ||
| 20 | +@property (nonatomic ,strong) UITextField * _Nullable textField; | ||
| 21 | + | ||
| 22 | +@end | ||
| 10 | 23 | ||
| 11 | @implementation PrivateView | 24 | @implementation PrivateView |
| 12 | 25 | ||
| 26 | +static NSString *message_content = @"message_content"; | ||
| 27 | + | ||
| 13 | + (instancetype)privateView | 28 | + (instancetype)privateView |
| 14 | { | 29 | { |
| 15 | - return [[PrivateView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 300, SCREEN_WIDTH, 300)]; | 30 | + static PrivateView *privateView; |
| 31 | + | ||
| 32 | + static dispatch_once_t onceToken; | ||
| 33 | + dispatch_once(&onceToken, ^{ | ||
| 34 | + privateView = [[PrivateView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, 300)]; | ||
| 35 | + }); | ||
| 36 | + return privateView; | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 40 | +{ | ||
| 41 | + if (self = [super initWithFrame:frame]) { | ||
| 42 | + | ||
| 43 | + [self addSubview:self.tableView]; | ||
| 44 | + [self addSubview:self.nameLbl]; | ||
| 45 | + [self.bottomTool addSubview:self.sendBtn]; | ||
| 46 | + [self.bottomTool addSubview:self.textField]; | ||
| 47 | + | ||
| 48 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | ||
| 49 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil]; | ||
| 50 | + } | ||
| 51 | + return self; | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +- (void)closeAction | ||
| 55 | +{ | ||
| 56 | + if ([self.delegate respondsToSelector:@selector(closeCurrentPopView)]) { | ||
| 57 | + [self.delegate closeCurrentPopView]; | ||
| 58 | + } | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +- (void)sendClick | ||
| 62 | +{ | ||
| 63 | + [self textFieldShouldReturn:self.textField]; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +- (void)keyboardWillShow:(NSNotification *)notify { | ||
| 67 | + | ||
| 68 | + NSDictionary *userInfo = notify.userInfo; | ||
| 69 | + CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame | ||
| 70 | + [UIView animateWithDuration:0.25 animations:^{ | ||
| 71 | + self.top = SCREEN_HEIGHT - newFrameKeyboard.size.height - self.height; | ||
| 72 | + }]; | ||
| 73 | + self.isEditing = YES; | ||
| 74 | + NSLog(@"showtop:%f",self.top); | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +- (void)keyboardWillHidden:(NSNotification *)notify { | ||
| 78 | + | ||
| 79 | + [UIView animateWithDuration:0.1 animations:^{ | ||
| 80 | + self.top = SCREEN_HEIGHT - 300; | ||
| 81 | + }]; | ||
| 82 | + NSLog(@"hiddentop:%f",self.top); | ||
| 83 | + self.isEditing = NO; | ||
| 84 | +} | ||
| 85 | + | ||
| 86 | +#pragma mark - UITextFieldDelegate | ||
| 87 | +- (BOOL)textFieldShouldReturn:(UITextField *)textField | ||
| 88 | +{ | ||
| 89 | + if (![textField.text isEqualToString:@""]) { | ||
| 90 | + | ||
| 91 | + NSDictionary *dic = @{message_content:textField.text}; | ||
| 92 | + weakself | ||
| 93 | + NSString *message = [Tools dictionaryToJson:dic]; | ||
| 94 | + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_PRIVATE targetId:@"1234" success:^(CNLiveChatMessage *message) { | ||
| 95 | + | ||
| 96 | + dispatch_async(dispatch_get_main_queue(), ^{ | ||
| 97 | + strongself | ||
| 98 | + NSDictionary *JSONDic = [Tools dictionaryWithJsonString:message.messageContent]; | ||
| 99 | + NSString *content = [JSONDic objectForKey:message_content]; | ||
| 100 | + | ||
| 101 | + //将消息显示到列表中 | ||
| 102 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | ||
| 103 | + model.name = message.userInfo.name; | ||
| 104 | + model.isMine = YES; | ||
| 105 | + model.content = content; | ||
| 106 | +// model.ID = message.targetId; | ||
| 107 | + model.icon = message.userInfo.portraitUri; | ||
| 108 | + model.priCellWidth = self.tableView.width * 0.5 - 30; | ||
| 109 | + // model.sendTime;//发送时间 | ||
| 110 | + [self.chatArray addObject:model]; | ||
| 111 | + [self.tableView reloadData]; | ||
| 112 | + | ||
| 113 | + NSInteger section = [self.tableView numberOfSections]; | ||
| 114 | + if (section < 1) return; | ||
| 115 | + NSInteger row = [self.tableView numberOfRowsInSection:section - 1]; | ||
| 116 | + if (row < 1) return; | ||
| 117 | + NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row - 1 inSection:section - 1]; | ||
| 118 | + [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES]; | ||
| 119 | + [self.tableView reloadData]; | ||
| 120 | + | ||
| 121 | + }); | ||
| 122 | + } error:^(CNLiveChatErrorCode errors, NSString *messageId, NSString *targetId) { | ||
| 123 | + NSLog(@"%@",messageId); | ||
| 124 | + }]; | ||
| 125 | + | ||
| 126 | + textField.text = @""; | ||
| 127 | + } | ||
| 128 | + [textField resignFirstResponder]; | ||
| 129 | + return YES; | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +- (void)endCurrentEditing | ||
| 133 | +{ | ||
| 134 | + self.top = SCREEN_HEIGHT - 300; | ||
| 135 | + [self.textField resignFirstResponder]; | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +#pragma mark - 私聊消息列表 | ||
| 139 | +#pragma mark - UITableViewDataSource | ||
| 140 | + | ||
| 141 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | ||
| 142 | +{ | ||
| 143 | + return self.chatArray.count; | ||
| 16 | } | 144 | } |
| 145 | + | ||
| 146 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | ||
| 147 | +{ | ||
| 148 | + PriChatCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PriChatCell class]) forIndexPath:indexPath]; | ||
| 149 | + [cell loadUIWithModel:self.chatArray[indexPath.row]]; | ||
| 150 | + return cell; | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +#pragma mark - UITableViewDelegate | ||
| 154 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | ||
| 155 | +{ | ||
| 156 | + return [self.chatArray[indexPath.row] priCellHeight]; | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +- (NSMutableArray *)chatArray | ||
| 160 | +{ | ||
| 161 | + if (!_chatArray) | ||
| 162 | + { | ||
| 163 | + _chatArray = [[NSMutableArray alloc] init]; | ||
| 164 | + } | ||
| 165 | + return _chatArray; | ||
| 166 | +} | ||
| 167 | + | ||
| 168 | +- (UILabel *)nameLbl | ||
| 169 | +{ | ||
| 170 | + if (!_nameLbl) | ||
| 171 | + { | ||
| 172 | + _nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, self.width - 100, 30)]; | ||
| 173 | + _nameLbl.centerX = self.width * 0.5; | ||
| 174 | + _nameLbl.text = @"哈哈哈主播的名字"; | ||
| 175 | + [_nameLbl setTextColor:[UIColor cyanColor]]; | ||
| 176 | + _nameLbl.numberOfLines = 1; | ||
| 177 | + _nameLbl.textAlignment = NSTextAlignmentCenter; | ||
| 178 | + } | ||
| 179 | + return _nameLbl; | ||
| 180 | +} | ||
| 181 | + | ||
| 182 | +- (UIButton *)closeBtn | ||
| 183 | +{ | ||
| 184 | + if (!_closeBtn) | ||
| 185 | + { | ||
| 186 | + UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 187 | + closeBtn.frame = CGRectMake(SCREEN_WIDTH - 41,10, 31, 30); | ||
| 188 | + [closeBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateNormal]; | ||
| 189 | + [closeBtn setImage:[UIImage imageNamed:@"close"] forState:UIControlStateHighlighted]; | ||
| 190 | + [closeBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 191 | + _closeBtn = closeBtn; | ||
| 192 | + [self addSubview:_closeBtn]; | ||
| 193 | + | ||
| 194 | + } | ||
| 195 | + return _closeBtn; | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +- (UITableView *)tableView | ||
| 199 | +{ | ||
| 200 | + if (!_tableView) | ||
| 201 | + { | ||
| 202 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.closeBtn.bottom + 10, self.width, self.height - self.closeBtn.bottom - 10 - self.bottomTool.height)]; | ||
| 203 | + [_tableView registerClass:[PriChatCell class] forCellReuseIdentifier:NSStringFromClass([PriChatCell class])]; | ||
| 204 | + _tableView.delegate = self; | ||
| 205 | + _tableView.dataSource = self; | ||
| 206 | + _tableView.showsVerticalScrollIndicator = NO; | ||
| 207 | + _tableView.showsHorizontalScrollIndicator = NO; | ||
| 208 | + } | ||
| 209 | + return _tableView; | ||
| 210 | +} | ||
| 211 | + | ||
| 212 | +- (UIImageView *)bottomTool | ||
| 213 | +{ | ||
| 214 | + if (!_bottomTool) | ||
| 215 | + { | ||
| 216 | + _bottomTool = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.height - 40, self.width, 40)]; | ||
| 217 | + _bottomTool.image = [[UIImage imageNamed:@"priToolBg"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0) resizingMode:UIImageResizingModeStretch]; | ||
| 218 | + _bottomTool.userInteractionEnabled = YES; | ||
| 219 | + | ||
| 220 | + [self addSubview:_bottomTool]; | ||
| 221 | + } | ||
| 222 | + return _bottomTool; | ||
| 223 | +} | ||
| 224 | + | ||
| 225 | +- (UIButton *)sendBtn | ||
| 226 | +{ | ||
| 227 | + if (!_sendBtn) | ||
| 228 | + { | ||
| 229 | + _sendBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.bottomTool.width - 60, 4, 60, self.bottomTool.height - 8)]; | ||
| 230 | + [_sendBtn setTitle:@"发送" forState:UIControlStateNormal]; | ||
| 231 | + [_sendBtn setTitleColor:[UIColor cyanColor] forState:UIControlStateNormal]; | ||
| 232 | + [_sendBtn addTarget:self action:@selector(sendClick) forControlEvents:UIControlEventTouchUpInside]; | ||
| 233 | + } | ||
| 234 | + return _sendBtn; | ||
| 235 | +} | ||
| 236 | + | ||
| 237 | +- (UITextField *)textField | ||
| 238 | +{ | ||
| 239 | + if (!_textField) | ||
| 240 | + { | ||
| 241 | + _textField = [[UITextField alloc] initWithFrame:CGRectMake(4, 4, self.bottomTool.width - self.sendBtn.width - 8, self.bottomTool.height - 8)]; | ||
| 242 | + _textField.borderStyle = UITextBorderStyleLine; | ||
| 243 | + _textField.returnKeyType = UIReturnKeySend; | ||
| 244 | + _textField.delegate = self; | ||
| 245 | + } | ||
| 246 | + return _textField; | ||
| 247 | +} | ||
| 248 | + | ||
| 17 | /* | 249 | /* |
| 18 | // Only override drawRect: if you perform custom drawing. | 250 | // Only override drawRect: if you perform custom drawing. |
| 19 | // An empty implementation adversely affects performance during animation. | 251 | // An empty implementation adversely affects performance during animation. |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/close.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "idiom" : "universal", | ||
| 9 | + "scale" : "2x" | ||
| 10 | + }, | ||
| 11 | + { | ||
| 12 | + "idiom" : "universal", | ||
| 13 | + "scale" : "3x" | ||
| 14 | + }, | ||
| 15 | + { | ||
| 16 | + "idiom" : "iphone", | ||
| 17 | + "scale" : "1x" | ||
| 18 | + }, | ||
| 19 | + { | ||
| 20 | + "idiom" : "iphone", | ||
| 21 | + "filename" : "close.png", | ||
| 22 | + "scale" : "2x" | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + "idiom" : "iphone", | ||
| 26 | + "scale" : "3x" | ||
| 27 | + } | ||
| 28 | + ], | ||
| 29 | + "info" : { | ||
| 30 | + "version" : 1, | ||
| 31 | + "author" : "xcode" | ||
| 32 | + } | ||
| 33 | +} | ||
| 0 | \ No newline at end of file | 34 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/close.imageset/close.png
0 → 100644
2.47 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/defaultUserIcon.imageset/Contents.json
| @@ -4,6 +4,14 @@ | @@ -4,6 +4,14 @@ | ||
| 4 | "idiom" : "universal", | 4 | "idiom" : "universal", |
| 5 | "filename" : "贡献榜小头像.png", | 5 | "filename" : "贡献榜小头像.png", |
| 6 | "scale" : "1x" | 6 | "scale" : "1x" |
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 7 | } | 15 | } |
| 8 | ], | 16 | ], |
| 9 | "info" : { | 17 | "info" : { |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/priToolBg.imageset/Contents.json
0 → 100644
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/priToolBg.imageset/priToolBg.png
0 → 100644
1.53 KB