Commit c84d1dd330cab182b916fc737b242d2f4329cc80

Authored by 张旭
1 parent 1d41702d

完善私聊页面,替换交互页面切图

Showing 17 changed files with 158 additions and 43 deletions
LiveVideoCloud/LiveVideoCloud/AppDelegate/AppDelegate.m
... ... @@ -39,15 +39,15 @@
39 39 /*
40 40 */
41 41 // 20170327 20170328
42   - /*
43   - CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170328" name:@"20170328" portrait:@""];
44   - [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) {
45   - NSLog(@"连接服务器-----success");
46   -
47   - } error:^(CNLiveChatConnectErrorCode errors) {
48   - NSLog(@"连接服务器失败-----%ld", errors);
49   - }];
50   - */
  42 +
  43 +// CNLiveChatUserInfo *userInfo = [[CNLiveChatUserInfo alloc] initWithUserId:@"20170327" name:@"20170327" portrait:@""];
  44 +// [[CNLiveChatManager sharedCNLiveChatManager] loginServer:userInfo success:^(NSString *userId) {
  45 +// NSLog(@"连接服务器-----success");
  46 +//
  47 +// } error:^(CNLiveChatConnectErrorCode errors) {
  48 +// NSLog(@"连接服务器失败-----%ld", errors);
  49 +// }];
  50 +//
51 51 [self.window makeKeyAndVisible];
52 52  
53 53 return YES;
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
... ... @@ -35,7 +35,7 @@
35 35 //如果计算过高度,直接返回
36 36 if (_priCellHeight) return _priCellHeight;
37 37  
38   - _priCellHeight = 10;
  38 + _priCellHeight = 30;
39 39 NSString *content = self.content;
40 40 //文字
41 41 CGFloat textMaxW = self.priCellWidth;
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/ComboCell.m
... ... @@ -11,7 +11,7 @@
11 11  
12 12 @interface ComboCell ()
13 13  
14   -@property (nonatomic ,strong) UIView * _Nullable bgView;
  14 +@property (nonatomic ,strong) UIImageView * _Nullable bgView;
15 15 @property (nonatomic ,strong) UIImageView * _Nullable icon;
16 16 @property (nonatomic ,strong) UILabel * _Nullable senderNameLbl;
17 17 @property (nonatomic ,strong) UILabel * _Nullable giftNameLbl;
... ... @@ -43,6 +43,7 @@
43 43 self.senderNameLbl.size = [self.senderNameLbl labelSize];
44 44 self.giftNameLbl.size = [self.giftNameLbl labelSize];
45 45 self.bgView.frame = CGRectMake(0, 0, self.width, self.height);
  46 + self.bgView.image = [UIImage imageNamed:@"背景220x40"];
46 47 self.bgView.layer.cornerRadius = self.height * 0.5;
47 48 self.giftImage.frame = CGRectMake(self.width - self.height, 0, self.height, self.height);
48 49 self.giftImage.image = [UIImage imageNamed:model.giftImageName];
... ... @@ -68,7 +69,7 @@
68 69 {
69 70 _senderNameLbl = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right + 5, 0, 100, 20)];
70 71 _senderNameLbl.font = [UIFont systemFontOfSize:kContentFont];
71   - _senderNameLbl.textColor = [UIColor blackColor];
  72 + _senderNameLbl.textColor = [UIColor whiteColor];
72 73 }
73 74 return _senderNameLbl;
74 75 }
... ... @@ -79,7 +80,7 @@
79 80 {
80 81 _giftNameLbl = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right + 5, self.senderNameLbl.bottom , 100, 20)];
81 82 _giftNameLbl.font = [UIFont systemFontOfSize:kContentFont];
82   - _giftNameLbl.textColor = [UIColor blackColor];
  83 + _giftNameLbl.textColor = [UIColor yellowColorZX];
83 84 }
84 85 return _giftNameLbl;
85 86 }
... ... @@ -91,9 +92,8 @@
91 92 _icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
92 93 _icon.clipsToBounds = YES;
93 94 _icon.layer.cornerRadius = 20;
94   - _icon.layer.borderWidth = 1;
95   - _icon.layer.borderColor = [UIColor cyanColor].CGColor;
96   -
  95 +// _icon.layer.borderWidth = 1;
  96 +// _icon.layer.borderColor = [UIColor cyanColor].CGColor;
97 97 }
98 98 return _icon;
99 99 }
... ... @@ -107,13 +107,13 @@
107 107 return _giftImage;
108 108 }
109 109  
110   -- (UIView *)bgView
  110 +- (UIImageView *)bgView
111 111 {
112 112 if (!_bgView)
113 113 {
114   - _bgView = [[UIView alloc] init];
115   - _bgView.backgroundColor = [UIColor yellowColor];
  114 + _bgView = [[UIImageView alloc] init];
116 115 _bgView.clipsToBounds = YES;
  116 + _bgView.alpha = 0.4;
117 117 }
118 118 return _bgView;
119 119 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentViewCell.m
... ... @@ -72,8 +72,8 @@
72 72 {
73 73 PresentLable *lable = [[PresentLable alloc] init];
74 74 lable.backgroundColor = [UIColor clearColor];
75   - lable.borderColor = [UIColor yellowColor];
76   - lable.textColor = [UIColor greenColor];
  75 + lable.borderColor = [UIColor orangeColor];
  76 + lable.textColor = [UIColor yellowColor];
77 77 lable.font = [UIFont systemFontOfSize:17.0];
78 78 lable.textAlignment = NSTextAlignmentCenter;
79 79 lable.alpha = 0.0;
... ... @@ -253,7 +253,7 @@
253 253 [UIView animateKeyframesWithDuration:interval delay:0 options:0 animations:^{
254 254  
255 255 [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1/2.0 animations:^{
256   - self.transform = CGAffineTransformMakeScale(4, 4);
  256 + self.transform = CGAffineTransformMakeScale(2.5, 2.5);
257 257 }];
258 258 [UIView addKeyframeWithRelativeStartTime:1/2.0 relativeDuration:1/2.0 animations:^{
259 259 self.transform = CGAffineTransformMakeScale(0.8, 0.8);
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
... ... @@ -7,8 +7,10 @@
7 7 //
8 8  
9 9 #import "BaseView.h"
  10 +#import "AnimationBaseView.h"
  11 +
10 12 @class PresentView;
11   -@class AnimationBaseView;
  13 +//@class AnimationBaseView;
12 14  
13 15 typedef NS_ENUM(NSInteger, BounceBtnType) {//弹窗按钮类型
14 16 BounceBtnTypeAite = 1,//@TA按钮点击
... ... @@ -25,7 +27,7 @@ typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型
25 27 @property (nonatomic) JumpControllerType jumpType;
26 28 @property (nonatomic ,strong) UIViewController * _Nullable viewController;
27 29 @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView;
28   -@property (nonatomic ,strong ,readonly) AnimationBaseView * _Nullable animationBaseView;
  30 +@property (nonatomic ,strong) AnimationBaseView * _Nullable animationBaseView;
29 31  
30 32 + (instancetype _Nullable)liveBaseView;
31 33  
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
... ... @@ -21,7 +21,6 @@
21 21 #import "userInfoModel.h"
22 22 #import "PrivateView.h"
23 23 #import "ChatBarrageView.h"
24   -#import "AnimationBaseView.h"
25 24  
26 25 #define BottomToolHeight 60
27 26  
... ... @@ -37,7 +36,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型
37 36 @interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,userClickDelegate,CNLiveChatManagerDelegate,PopViewDelegate>
38 37  
39 38 @property (nonatomic ,strong ) UIScrollView * _Nullable scrollView;
40   -@property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View
  39 +//@property (nonatomic ,strong ,readwrite) AnimationBaseView * _Nullable animationBaseView;//展示层View
41 40 @property (nonatomic ,strong ) BottomToolView* _Nullable bottomToolView;
42 41 @property (nonatomic ,strong ) UIButton * _Nullable closeBtn;
43 42 @property (nonatomic ,strong ) GiftListView * _Nullable giftListView;
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.m
... ... @@ -14,6 +14,7 @@
14 14 @interface PriChatCell ()
15 15  
16 16 @property (nonatomic ,strong) chatMsgModel * _Nullable model;
  17 +@property (nonatomic ,strong) UIImageView * _Nullable bgImgView;
17 18 @property (nonatomic ,strong) UIImageView * _Nullable icon;
18 19 @property (nonatomic ,strong) UILabel * _Nullable content;
19 20  
... ... @@ -36,51 +37,67 @@
36 37 _model = model;
37 38 [self bindView];
38 39 [self.icon sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil];
  40 + self.icon.backgroundColor = [UIColor greenColor];
39 41 self.content.text = model.content;
40 42 CGSize size = [self.content labelSizeWithWidth:_model.priCellWidth];
  43 +
41 44 if (_model.isMine) {
42   - if (_model.priCellHeight < 37) {//1行 // 36.7
43   -
44   - self.content.frame = CGRectMake(self.width - 30 - size.width - 10, 2.5, size.width, size.height);//self.height - 5
  45 + if (_model.priCellHeight < 57) {//1行 // 36.7
  46 + self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25);
  47 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;
  48 + self.content.frame = CGRectMake(self.width - 30 - size.width - 20 - 25, 2.5, size.width, size.height);
45 49 self.content.textAlignment = NSTextAlignmentRight;
46   - self.content.centerY = self.icon.centerY;
  50 + self.content.centerY = self.height * 0.5;
  51 + self.bgImgView.frame = CGRectMake(self.content.left - 15, self.content.top - 10, self.content.width + 45, self.content.height + 20);
47 52 }else
48 53 {
49   - self.content.frame = CGRectMake(self.width - 30 - size.width - 10, 10, size.width, size.height);//self.height - 5
  54 + self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25);
  55 + self.icon.centerY = (self.height - 25)*0.5 + 12.5;
  56 + self.content.frame = CGRectMake(self.width - 30 - size.width - 20 - 25, 10, size.width, size.height);
50 57 self.content.textAlignment = NSTextAlignmentLeft;
  58 + self.content.centerY = self.height * 0.5;
  59 + self.bgImgView.frame = CGRectMake(self.content.left - 15, self.content.top - 10, self.content.width + 50, self.content.height + 20);
51 60 }
  61 +
  62 + self.bgImgView.image = [[UIImage imageNamed:@"right"]stretchableImageWithLeftCapWidth:167 topCapHeight:100];
52 63 }else
53 64 {
54   - if (_model.priCellHeight < 37) {//1行
  65 + if (_model.priCellHeight < 57) {//1行
55 66 self.icon.frame = CGRectMake(5, 6, 25, 25);
56 67 self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
57   - self.content.frame = CGRectMake(5 + 30 + 10, 2.5, size.width, size.height);//self.height - 5
  68 + self.content.frame = CGRectMake(5 + 25 + 35, 2.5, size.width, size.height);
58 69 self.content.textAlignment = NSTextAlignmentLeft;
59 70 self.content.centerY = self.icon.centerY;
  71 + self.bgImgView.frame = CGRectMake(self.content.left - 25, self.content.top - 10, self.content.width + 45, self.content.height + 20);
60 72 }else
61 73 {
62 74 self.icon.frame = CGRectMake(5, 6, 25, 25);
63 75 self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
64   - self.content.frame = CGRectMake(5 + 30 + 10, 10, size.width, size.height);//self.height - 5
  76 + self.content.frame = CGRectMake(5 + 25 + 35 + 15, 10, size.width, size.height);
65 77 self.content.textAlignment = NSTextAlignmentLeft;
  78 + self.content.centerY = self.height * 0.5;
  79 + self.bgImgView.frame = CGRectMake(self.content.left - 35 - 5, self.content.top - 10, self.content.width + 50, self.content.height + 20);
66 80 }
  81 +
  82 + self.bgImgView.image = [[UIImage imageNamed:@"left"] stretchableImageWithLeftCapWidth:189 topCapHeight:164];
  83 +
67 84 }
  85 + _icon.layer.cornerRadius = _icon.height * 0.5;
  86 + [self sendSubviewToBack:self.bgImgView];
68 87 }
69 88  
70 89 - (void)bindView
71 90 {
72 91 if (_model.isMine) {
73 92 self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25);
74   - NSLog(@"self.icon.centerY%f,%f",self.height * 0.5,_model.priCellHeight);//13.353516 21.707031 155.363281
  93 +// NSLog(@"self.icon.centerY%f,%f",self.height * 0.5,_model.priCellHeight);//13.353516 21.707031 155.363281
75 94 self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
76 95 self.content.frame = CGRectMake(self.width - 30 - CHAT_POP_WIDTH, 2.5, CHAT_POP_WIDTH - 10, self.height - 5);
77   - self.content.backgroundColor = [UIColor blueColorZX];
78 96  
79 97 }else{
80 98 self.icon.frame = CGRectMake(5, 6, 25, 25);
81 99 self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516;
82 100 self.content.frame = CGRectMake(5 + 30, 2.5, CHAT_POP_WIDTH, self.height - 5);
83   - self.content.backgroundColor = [UIColor greenColor];
84 101 }
85 102 }
86 103  
... ... @@ -105,12 +122,22 @@
105 122 {
106 123 _icon = [[UIImageView alloc] init];
107 124 _icon.layer.masksToBounds = YES;
108   - _icon.layer.cornerRadius = 15.f;
109 125 [self addSubview:_icon];
110 126 }
111 127 return _icon;
112 128 }
113 129  
  130 +- (UIImageView * _Nullable)bgImgView
  131 +{
  132 + if (!_bgImgView)
  133 + {
  134 + _bgImgView = [[UIImageView alloc] init];
  135 +
  136 + [self addSubview:_bgImgView];
  137 + }
  138 + return _bgImgView;
  139 +}
  140 +
114 141 - (void)awakeFromNib {
115 142 [super awakeFromNib];
116 143 // Initialization code
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.m
... ... @@ -80,7 +80,6 @@ static NSString *message_content = @&quot;message_content&quot;;
80 80 self.top = SCREEN_HEIGHT - newFrameKeyboard.size.height - self.height;
81 81 }];
82 82 self.isEditing = YES;
83   - NSLog(@"showtop:%f",self.top);
84 83 }
85 84 }
86 85  
... ... @@ -91,7 +90,6 @@ static NSString *message_content = @&quot;message_content&quot;;
91 90 [UIView animateWithDuration:0.1 animations:^{
92 91 self.top = SCREEN_HEIGHT - 300;
93 92 }];
94   - NSLog(@"hiddentop:%f",self.top);
95 93 self.isEditing = NO;
96 94 }
97 95 }
... ... @@ -104,7 +102,7 @@ static NSString *message_content = @&quot;message_content&quot;;
104 102 NSDictionary *dic = @{message_content:textField.text};
105 103 weakself
106 104 NSString *message = [Tools dictionaryToJson:dic];
107   - [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_PRIVATE targetId:@"20170327" success:^(CNLiveChatMessage *message) {
  105 + [[CNLiveChatManager sharedCNLiveChatManager] sendMessage:message type:CNLive_ConversationType_PRIVATE targetId:@"20170328" success:^(CNLiveChatMessage *message) {
108 106  
109 107 dispatch_async(dispatch_get_main_queue(), ^{
110 108 strongself
... ... @@ -256,7 +254,8 @@ static NSString *message_content = @&quot;message_content&quot;;
256 254 if (!_textField)
257 255 {
258 256 _textField = [[UITextField alloc] initWithFrame:CGRectMake(4, 4, self.bottomTool.width - self.sendBtn.width - 8, self.bottomTool.height - 8)];
259   - _textField.borderStyle = UITextBorderStyleLine;
  257 + _textField.borderStyle = UITextBorderStyleNone;
  258 + _textField.placeholder = @"和主播说点什么吧";
260 259 _textField.returnKeyType = UIReturnKeySend;
261 260 _textField.delegate = self;
262 261 }
... ...
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
... ... @@ -122,6 +122,12 @@
122 122 - (void)startCapture:(UIButton *)button { // 开始推流
123 123  
124 124 [_quitButton removeFromSuperview];
  125 + [_openFilterButton removeFromSuperview];
  126 + [_changeCameraButton removeFromSuperview];
  127 + [_openFlashButton removeFromSuperview];
  128 + _openFilterButton = nil;
  129 + _changeCameraButton = nil;
  130 + _openFlashButton = nil;
125 131  
126 132 _isStreaming = YES;
127 133  
... ... @@ -131,7 +137,10 @@
131 137 NSLog(@"开启推流成功 ------- success");
132 138  
133 139 [self.view insertSubview:self.liveBaseView atIndex:1];
134   -
  140 + [self.liveBaseView.animationBaseView addSubview:self.openFilterButton];
  141 + [self.liveBaseView.animationBaseView addSubview:self.changeCameraButton];
  142 + [self.liveBaseView.animationBaseView addSubview:self.openFlashButton];
  143 +
135 144 } failure:^(NSDictionary *errorDic) {
136 145 //NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding];
137 146 NSLog(@"%@",errorDic);
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/22.imageset/Contents.json
... ... @@ -4,6 +4,14 @@
4 4 "idiom" : "universal",
5 5 "filename" : "22.png",
6 6 "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
7 15 }
8 16 ],
9 17 "info" : {
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/left.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "left.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 +}
0 22 \ No newline at end of file
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/left.imageset/left.png 0 → 100644

28 KB

LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/right.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "right.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 +}
0 22 \ No newline at end of file
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Chat/right.imageset/right.png 0 → 100644

27.9 KB

LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景220x40.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "背景220x40.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 +}
0 22 \ No newline at end of file
... ...
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景220x40.imageset/背景220x40.png 0 → 100644

1.42 KB

LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/privateChat11.imageset/Contents.json
... ... @@ -4,6 +4,14 @@
4 4 "idiom" : "universal",
5 5 "filename" : "privateChat11.png",
6 6 "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
7 15 }
8 16 ],
9 17 "info" : {
... ...