Commit 69c0eaecd7e8bcb849863f408254f60bc980ed5f
1 parent
ebb60740
整合推流和交互页面
Showing
14 changed files
with
138 additions
and
64 deletions
LiveVideoCloud/LiveVideoCloud/Classes/Helpers/Tools.h
| @@ -27,6 +27,8 @@ typedef NS_ENUM(NSInteger, ShowMessageType) {//消息背景类型 | @@ -27,6 +27,8 @@ typedef NS_ENUM(NSInteger, ShowMessageType) {//消息背景类型 | ||
| 27 | 27 | ||
| 28 | + (void)closeBouces; | 28 | + (void)closeBouces; |
| 29 | 29 | ||
| 30 | ++ (void)showNaviViewWithMessage:(NSString *_Nonnull)message; | ||
| 31 | + | ||
| 30 | + (NSString *_Nullable)dictionaryToJson:(NSDictionary *_Nullable)dic; | 32 | + (NSString *_Nullable)dictionaryToJson:(NSDictionary *_Nullable)dic; |
| 31 | 33 | ||
| 32 | + (NSDictionary *_Nullable)dictionaryWithJsonString:(NSString *_Nullable)jsonString; | 34 | + (NSDictionary *_Nullable)dictionaryWithJsonString:(NSString *_Nullable)jsonString; |
LiveVideoCloud/LiveVideoCloud/Classes/Helpers/Tools.m
| @@ -83,6 +83,32 @@ | @@ -83,6 +83,32 @@ | ||
| 83 | }]; | 83 | }]; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | ++ (void)showNaviViewWithMessage:(NSString *_Nonnull)message | ||
| 87 | +{ | ||
| 88 | + UIImageView *bgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, - 60, SCREEN_WIDTH, 60)]; | ||
| 89 | + bgView.backgroundColor = [UIColor cyanColor]; | ||
| 90 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 25, SCREEN_WIDTH - 20, 30)]; | ||
| 91 | + label.text = message; | ||
| 92 | + label.textAlignment = NSTextAlignmentCenter; | ||
| 93 | + label.textColor = [UIColor whiteColor]; | ||
| 94 | + [bgView addSubview:label]; | ||
| 95 | + [[UIApplication sharedApplication].keyWindow addSubview:bgView]; | ||
| 96 | + | ||
| 97 | + [UIView animateWithDuration:0.5 animations:^{ | ||
| 98 | + bgView.top = 0; | ||
| 99 | + } completion:^(BOOL finished) { | ||
| 100 | + NSTimer *timer = [NSTimer timerWithTimeInterval:3 repeats:NO block:^(NSTimer * _Nonnull timer) { | ||
| 101 | + [UIView animateWithDuration:0.5 animations:^{ | ||
| 102 | + bgView.top = - 60; | ||
| 103 | + } completion:^(BOOL finished) { | ||
| 104 | + [bgView removeFromSuperview]; | ||
| 105 | + }]; | ||
| 106 | + }]; | ||
| 107 | + [[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes]; | ||
| 108 | + }]; | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | + | ||
| 86 | /** | 112 | /** |
| 87 | 把字典转换成格式化的JSON格式的字符串 | 113 | 把字典转换成格式化的JSON格式的字符串 |
| 88 | 114 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/AnimationBaseView.m
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | - (instancetype)initWithFrame:(CGRect)frame | 14 | - (instancetype)initWithFrame:(CGRect)frame |
| 15 | { | 15 | { |
| 16 | if (self = [super initWithFrame:frame]) { | 16 | if (self = [super initWithFrame:frame]) { |
| 17 | - self.backgroundColor = [UIColor redColor]; | 17 | + |
| 18 | self.clipsToBounds = YES; | 18 | self.clipsToBounds = YES; |
| 19 | } | 19 | } |
| 20 | return self; | 20 | return self; |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
| @@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
| 35 | //如果计算过高度,直接返回 | 35 | //如果计算过高度,直接返回 |
| 36 | if (_priCellHeight) return _priCellHeight; | 36 | if (_priCellHeight) return _priCellHeight; |
| 37 | 37 | ||
| 38 | - _priCellHeight = 0; | 38 | + _priCellHeight = 10; |
| 39 | NSString *content = self.content; | 39 | NSString *content = self.content; |
| 40 | //文字 | 40 | //文字 |
| 41 | CGFloat textMaxW = self.priCellWidth; | 41 | CGFloat textMaxW = self.priCellWidth; |
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:kContentFont]} context:nil].size; | 43 | CGSize textSize = [content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:kContentFont]} context:nil].size; |
| 44 | 44 | ||
| 45 | //底部空隙 | 45 | //底部空隙 |
| 46 | - _priCellHeight += textSize.height + 5; | 46 | + _priCellHeight += textSize.height + 10; |
| 47 | // NSLog(@"pricellHeight = %f",_priCellHeight); | 47 | // NSLog(@"pricellHeight = %f",_priCellHeight); |
| 48 | return _priCellHeight; | 48 | return _priCellHeight; |
| 49 | } | 49 | } |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
| @@ -16,8 +16,13 @@ typedef NS_ENUM(NSInteger, BounceBtnType) {//弹窗按钮类型 | @@ -16,8 +16,13 @@ typedef NS_ENUM(NSInteger, BounceBtnType) {//弹窗按钮类型 | ||
| 16 | BounceBtnTypeHome ,//主页按钮点击 | 16 | BounceBtnTypeHome ,//主页按钮点击 |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | +typedef NS_ENUM(NSInteger, JumpControllerType) {//跳转控制器类型 | ||
| 20 | + JumpControllerTypePresent = 1,//present | ||
| 21 | + JumpControllerTypePush //push | ||
| 22 | +}; | ||
| 19 | @interface LiveBaseView : BaseView | 23 | @interface LiveBaseView : BaseView |
| 20 | 24 | ||
| 25 | +@property (nonatomic) JumpControllerType jumpType; | ||
| 21 | @property (nonatomic ,strong) UIViewController * _Nullable viewController; | 26 | @property (nonatomic ,strong) UIViewController * _Nullable viewController; |
| 22 | @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView; | 27 | @property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView; |
| 23 | @property (nonatomic ,strong ,readonly) AnimationBaseView * _Nullable animationBaseView; | 28 | @property (nonatomic ,strong ,readonly) AnimationBaseView * _Nullable animationBaseView; |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| @@ -52,7 +52,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -52,7 +52,7 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 52 | @property (nonatomic ,assign ) CGFloat offsetHeight; | 52 | @property (nonatomic ,assign ) CGFloat offsetHeight; |
| 53 | @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; | 53 | @property (nonatomic ,strong ) UISwitch * _Nullable barrageSwitch; |
| 54 | @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; | 54 | @property (nonatomic ,strong ) ChatBarrageManager * _Nullable chatManager; |
| 55 | -@property (nonatomic ,strong) ChatBarrageView * _Nullable barrageView; | 55 | +@property (nonatomic ,strong ) ChatBarrageView * _Nullable barrageView; |
| 56 | 56 | ||
| 57 | @end | 57 | @end |
| 58 | 58 | ||
| @@ -87,8 +87,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -87,8 +87,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 87 | self.chatTableView.alpha = 0.7; | 87 | self.chatTableView.alpha = 0.7; |
| 88 | 88 | ||
| 89 | [self.animationBaseView addSubview:self.topToolsView]; | 89 | [self.animationBaseView addSubview:self.topToolsView]; |
| 90 | - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:self]; | ||
| 91 | - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:self]; | 90 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; |
| 91 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil]; | ||
| 92 | 92 | ||
| 93 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; | 93 | [CNLiveChatManager sharedCNLiveChatManager].delegate = self; |
| 94 | [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"1234" messageCount:10 success:^(NSString *targetId) { | 94 | [[CNLiveChatManager sharedCNLiveChatManager] joinChatRoom:@"1234" messageCount:10 success:^(NSString *targetId) { |
| @@ -102,9 +102,16 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -102,9 +102,16 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 102 | return self; | 102 | return self; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | +- (void)dealloc | ||
| 106 | +{ | ||
| 107 | + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; | ||
| 108 | + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; | ||
| 109 | +} | ||
| 110 | + | ||
| 105 | - (void)keyboardWillShow:(NSNotification *)notify { | 111 | - (void)keyboardWillShow:(NSNotification *)notify { |
| 106 | - if ([notify.object isKindOfClass:[LiveBaseView class]]) { | ||
| 107 | - | 112 | + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard]; |
| 113 | + if ([class isEqualToString:NSStringFromClass([self class])]) | ||
| 114 | + { | ||
| 108 | NSDictionary *userInfo = notify.userInfo; | 115 | NSDictionary *userInfo = notify.userInfo; |
| 109 | CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame | 116 | CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame |
| 110 | [UIView animateWithDuration:0.25 animations:^{ | 117 | [UIView animateWithDuration:0.25 animations:^{ |
| @@ -115,7 +122,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -115,7 +122,9 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 115 | } | 122 | } |
| 116 | 123 | ||
| 117 | - (void)keyboardWillHidden:(NSNotification *)notify { | 124 | - (void)keyboardWillHidden:(NSNotification *)notify { |
| 118 | - if ([notify.object isKindOfClass:[LiveBaseView class]]) { | 125 | + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard]; |
| 126 | + if ([class isEqualToString:NSStringFromClass([self class])]) | ||
| 127 | + { | ||
| 119 | [UIView animateWithDuration:0.1 animations:^{ | 128 | [UIView animateWithDuration:0.1 animations:^{ |
| 120 | self.animationBaseView.top = 0; | 129 | self.animationBaseView.top = 0; |
| 121 | [self.animationBaseView setNeedsDisplay]; | 130 | [self.animationBaseView setNeedsDisplay]; |
| @@ -259,7 +268,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -259,7 +268,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 259 | case BtnClickTypeChat: | 268 | case BtnClickTypeChat: |
| 260 | { | 269 | { |
| 261 | self.popType = PopTypeChat; | 270 | self.popType = PopTypeChat; |
| 262 | - | 271 | + [[NSUserDefaults standardUserDefaults] setObject:NSStringFromClass([self class]) forKey:keyboard]; |
| 272 | + [[NSUserDefaults standardUserDefaults] synchronize]; | ||
| 263 | [self showCommentText]; | 273 | [self showCommentText]; |
| 264 | } | 274 | } |
| 265 | break; | 275 | break; |
| @@ -268,6 +278,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -268,6 +278,8 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 268 | self.popType = PopTypePriMessage; | 278 | self.popType = PopTypePriMessage; |
| 269 | [self hiddenView:YES]; | 279 | [self hiddenView:YES]; |
| 270 | [self showPrivateView]; | 280 | [self showPrivateView]; |
| 281 | + [[NSUserDefaults standardUserDefaults] setObject:NSStringFromClass([PrivateView class]) forKey:keyboard]; | ||
| 282 | + [[NSUserDefaults standardUserDefaults] synchronize]; | ||
| 271 | } | 283 | } |
| 272 | break; | 284 | break; |
| 273 | case BtnClickTypeGift: | 285 | case BtnClickTypeGift: |
| @@ -345,7 +357,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -345,7 +357,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 345 | [self.giftPopView removeFromSuperview]; | 357 | [self.giftPopView removeFromSuperview]; |
| 346 | }]; | 358 | }]; |
| 347 | } | 359 | } |
| 348 | - | ||
| 349 | } | 360 | } |
| 350 | break; | 361 | break; |
| 351 | default: | 362 | default: |
| @@ -353,7 +364,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -353,7 +364,6 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 353 | } | 364 | } |
| 354 | } | 365 | } |
| 355 | 366 | ||
| 356 | - | ||
| 357 | #pragma mark - buttonClick触摸屏幕关闭方法 | 367 | #pragma mark - buttonClick触摸屏幕关闭方法 |
| 358 | - (void)tapGestureClick:(UITapGestureRecognizer *)gesture | 368 | - (void)tapGestureClick:(UITapGestureRecognizer *)gesture |
| 359 | { | 369 | { |
| @@ -364,7 +374,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | @@ -364,7 +374,20 @@ typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | ||
| 364 | 374 | ||
| 365 | - (void)closeAction | 375 | - (void)closeAction |
| 366 | { | 376 | { |
| 367 | - [self.viewController.navigationController popViewControllerAnimated:YES]; | 377 | + switch (self.jumpType) { |
| 378 | + case JumpControllerTypePresent: | ||
| 379 | + { | ||
| 380 | + [self.viewController dismissViewControllerAnimated:YES completion:nil]; | ||
| 381 | + } | ||
| 382 | + break; | ||
| 383 | + case JumpControllerTypePush: | ||
| 384 | + { | ||
| 385 | + [self.viewController.navigationController popViewControllerAnimated:YES]; | ||
| 386 | + } | ||
| 387 | + break; | ||
| 388 | + default: | ||
| 389 | + break; | ||
| 390 | + } | ||
| 368 | } | 391 | } |
| 369 | 392 | ||
| 370 | - (void)sendClick | 393 | - (void)sendClick |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PriChatCell.m
| @@ -37,15 +37,43 @@ | @@ -37,15 +37,43 @@ | ||
| 37 | [self bindView]; | 37 | [self bindView]; |
| 38 | [self.icon sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil]; | 38 | [self.icon sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil]; |
| 39 | self.content.text = model.content; | 39 | self.content.text = model.content; |
| 40 | + CGSize size = [self.content labelSizeWithWidth:_model.priCellWidth]; | ||
| 41 | + 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 | + self.content.textAlignment = NSTextAlignmentRight; | ||
| 46 | + self.content.centerY = self.icon.centerY; | ||
| 47 | + }else | ||
| 48 | + { | ||
| 49 | + self.content.frame = CGRectMake(self.width - 30 - size.width - 10, 10, size.width, size.height);//self.height - 5 | ||
| 50 | + self.content.textAlignment = NSTextAlignmentLeft; | ||
| 51 | + } | ||
| 52 | + }else | ||
| 53 | + { | ||
| 54 | + if (_model.priCellHeight < 37) {//1行 | ||
| 55 | + self.icon.frame = CGRectMake(5, 6, 25, 25); | ||
| 56 | + 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 | ||
| 58 | + self.content.textAlignment = NSTextAlignmentLeft; | ||
| 59 | + self.content.centerY = self.icon.centerY; | ||
| 60 | + }else | ||
| 61 | + { | ||
| 62 | + self.icon.frame = CGRectMake(5, 6, 25, 25); | ||
| 63 | + 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 | ||
| 65 | + self.content.textAlignment = NSTextAlignmentLeft; | ||
| 66 | + } | ||
| 67 | + } | ||
| 40 | } | 68 | } |
| 41 | 69 | ||
| 42 | - (void)bindView | 70 | - (void)bindView |
| 43 | { | 71 | { |
| 44 | if (_model.isMine) { | 72 | if (_model.isMine) { |
| 45 | self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25); | 73 | self.icon.frame = CGRectMake(self.width - 30, 6, 25, 25); |
| 46 | - NSLog(@"self.icon.centerY%f",self.height * 0.5);//13.353516 | 74 | + NSLog(@"self.icon.centerY%f,%f",self.height * 0.5,_model.priCellHeight);//13.353516 21.707031 155.363281 |
| 47 | self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516; | 75 | self.icon.centerY = (self.height - 25)*0.5 + 12.5;//13.353516; |
| 48 | - self.content.frame = CGRectMake(self.width - 30 - 5 - CHAT_POP_WIDTH, 2.5, CHAT_POP_WIDTH, self.height - 5); | 76 | + self.content.frame = CGRectMake(self.width - 30 - CHAT_POP_WIDTH, 2.5, CHAT_POP_WIDTH - 10, self.height - 5); |
| 49 | self.content.backgroundColor = [UIColor blueColorZX]; | 77 | self.content.backgroundColor = [UIColor blueColorZX]; |
| 50 | 78 | ||
| 51 | }else{ | 79 | }else{ |
| @@ -66,8 +94,6 @@ | @@ -66,8 +94,6 @@ | ||
| 66 | _content.textColor = [UIColor blackColor]; | 94 | _content.textColor = [UIColor blackColor]; |
| 67 | _content.numberOfLines = 0; | 95 | _content.numberOfLines = 0; |
| 68 | _content.font = [UIFont systemFontOfSize:kContentFont]; | 96 | _content.font = [UIFont systemFontOfSize:kContentFont]; |
| 69 | - _content.layer.cornerRadius = 10; | ||
| 70 | - _content.layer.masksToBounds = YES; | ||
| 71 | [self addSubview:_content]; | 97 | [self addSubview:_content]; |
| 72 | } | 98 | } |
| 73 | return _content; | 99 | return _content; |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/PrivateView/PrivateView.m
| @@ -45,8 +45,8 @@ static NSString *message_content = @"message_content"; | @@ -45,8 +45,8 @@ static NSString *message_content = @"message_content"; | ||
| 45 | [self.bottomTool addSubview:self.sendBtn]; | 45 | [self.bottomTool addSubview:self.sendBtn]; |
| 46 | [self.bottomTool addSubview:self.textField]; | 46 | [self.bottomTool addSubview:self.textField]; |
| 47 | 47 | ||
| 48 | - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:self]; | ||
| 49 | - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:self]; | 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 | } | 50 | } |
| 51 | return self; | 51 | return self; |
| 52 | } | 52 | } |
| @@ -63,9 +63,17 @@ static NSString *message_content = @"message_content"; | @@ -63,9 +63,17 @@ static NSString *message_content = @"message_content"; | ||
| 63 | [self textFieldShouldReturn:self.textField]; | 63 | [self textFieldShouldReturn:self.textField]; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | +- (void)dealloc | ||
| 67 | +{ | ||
| 68 | + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; | ||
| 69 | + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; | ||
| 70 | +} | ||
| 71 | + | ||
| 66 | - (void)keyboardWillShow:(NSNotification *)notify { | 72 | - (void)keyboardWillShow:(NSNotification *)notify { |
| 67 | 73 | ||
| 68 | - if ([notify.object isKindOfClass:[PrivateView class]]) { | 74 | + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard]; |
| 75 | + if ([class isEqualToString:NSStringFromClass([self class])]) | ||
| 76 | + { | ||
| 69 | NSDictionary *userInfo = notify.userInfo; | 77 | NSDictionary *userInfo = notify.userInfo; |
| 70 | CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame | 78 | CGRect newFrameKeyboard = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];//变化前的frame |
| 71 | [UIView animateWithDuration:0.25 animations:^{ | 79 | [UIView animateWithDuration:0.25 animations:^{ |
| @@ -77,8 +85,9 @@ static NSString *message_content = @"message_content"; | @@ -77,8 +85,9 @@ static NSString *message_content = @"message_content"; | ||
| 77 | } | 85 | } |
| 78 | 86 | ||
| 79 | - (void)keyboardWillHidden:(NSNotification *)notify { | 87 | - (void)keyboardWillHidden:(NSNotification *)notify { |
| 80 | - | ||
| 81 | - if ([notify.object isKindOfClass:[PrivateView class]]) { | 88 | + NSString *class = [[NSUserDefaults standardUserDefaults] objectForKey:keyboard]; |
| 89 | + if ([class isEqualToString:NSStringFromClass([self class])]) | ||
| 90 | + { | ||
| 82 | [UIView animateWithDuration:0.1 animations:^{ | 91 | [UIView animateWithDuration:0.1 animations:^{ |
| 83 | self.top = SCREEN_HEIGHT - 300; | 92 | self.top = SCREEN_HEIGHT - 300; |
| 84 | }]; | 93 | }]; |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/LiveSections/Controller/LVCLiveViewController.m
| @@ -11,6 +11,7 @@ | @@ -11,6 +11,7 @@ | ||
| 11 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> | 11 | #import <CNLivePlayerSDK/CNLiveWebcastManager.h> |
| 12 | #import "FilterFunctionView.h" | 12 | #import "FilterFunctionView.h" |
| 13 | #import "LVCUGCLivePrepareView.h" | 13 | #import "LVCUGCLivePrepareView.h" |
| 14 | +#import "LiveBaseView.h" | ||
| 14 | 15 | ||
| 15 | #define KAppId @"60_irn9edco29" | 16 | #define KAppId @"60_irn9edco29" |
| 16 | #define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" | 17 | #define KAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" |
| @@ -33,6 +34,9 @@ | @@ -33,6 +34,9 @@ | ||
| 33 | 34 | ||
| 34 | @property (nonatomic, strong) UIButton *openFlashButton; | 35 | @property (nonatomic, strong) UIButton *openFlashButton; |
| 35 | 36 | ||
| 37 | +@property (nonatomic ,strong) LiveBaseView * _Nullable liveBaseView; | ||
| 38 | + | ||
| 39 | + | ||
| 36 | @end | 40 | @end |
| 37 | 41 | ||
| 38 | @implementation LVCLiveViewController | 42 | @implementation LVCLiveViewController |
| @@ -43,6 +47,7 @@ | @@ -43,6 +47,7 @@ | ||
| 43 | self.view.backgroundColor = [UIColor blueColor]; | 47 | self.view.backgroundColor = [UIColor blueColor]; |
| 44 | 48 | ||
| 45 | [self.view addSubview:self.captureView]; | 49 | [self.view addSubview:self.captureView]; |
| 50 | + | ||
| 46 | [self.view addSubview:self.prepareView]; | 51 | [self.view addSubview:self.prepareView]; |
| 47 | [self.view addSubview:self.quitButton]; | 52 | [self.view addSubview:self.quitButton]; |
| 48 | [self.view addSubview:self.changeCameraButton]; | 53 | [self.view addSubview:self.changeCameraButton]; |
| @@ -101,13 +106,28 @@ | @@ -101,13 +106,28 @@ | ||
| 101 | 106 | ||
| 102 | } | 107 | } |
| 103 | 108 | ||
| 109 | +- (LiveBaseView *)liveBaseView | ||
| 110 | +{ | ||
| 111 | + if (!_liveBaseView) | ||
| 112 | + { | ||
| 113 | + _liveBaseView = [LiveBaseView liveBaseView]; | ||
| 114 | + _liveBaseView.jumpType = JumpControllerTypePresent; | ||
| 115 | + _liveBaseView.viewController = self; | ||
| 116 | + _liveBaseView.backgroundColor = [UIColor clearColor]; | ||
| 117 | + } | ||
| 118 | + return _liveBaseView; | ||
| 119 | +} | ||
| 120 | + | ||
| 104 | #pragma mark - UIButton Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 121 | #pragma mark - UIButton Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 105 | - (void)startCapture:(UIButton *)button { // 开始推流 | 122 | - (void)startCapture:(UIButton *)button { // 开始推流 |
| 106 | - | 123 | + [_quitButton removeFromSuperview]; |
| 107 | [_prepareView removeFromSuperview]; | 124 | [_prepareView removeFromSuperview]; |
| 108 | 125 | ||
| 109 | [_kitCN startStream:^{ | 126 | [_kitCN startStream:^{ |
| 110 | NSLog(@"开启推流成功 ------- success"); | 127 | NSLog(@"开启推流成功 ------- success"); |
| 128 | + | ||
| 129 | + [self.view insertSubview:self.liveBaseView atIndex:1]; | ||
| 130 | + | ||
| 111 | } failure:^(NSDictionary *errorDic) { | 131 | } failure:^(NSDictionary *errorDic) { |
| 112 | NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding]; | 132 | NSString *str=[[NSMutableString alloc] initWithData:errorDic[@"errorMessage"] encoding:NSUTF8StringEncoding]; |
| 113 | NSLog(@"%@",str); | 133 | NSLog(@"%@",str); |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/HomeViewController.m
| @@ -8,31 +8,16 @@ | @@ -8,31 +8,16 @@ | ||
| 8 | 8 | ||
| 9 | #import "HomeViewController.h" | 9 | #import "HomeViewController.h" |
| 10 | #import "LVCLivePlayerController.h" | 10 | #import "LVCLivePlayerController.h" |
| 11 | -#import "LVCInteractionController.h" | ||
| 12 | #import "LVCLivePlayerController.h" | 11 | #import "LVCLivePlayerController.h" |
| 13 | #import "LVCUGCLivePlayerController.h" | 12 | #import "LVCUGCLivePlayerController.h" |
| 14 | #import "LVCTVLiveViewController.h" | 13 | #import "LVCTVLiveViewController.h" |
| 15 | 14 | ||
| 16 | @interface HomeViewController () | 15 | @interface HomeViewController () |
| 17 | 16 | ||
| 18 | -@property (nonatomic ,strong) UIButton * _Nullable interactionBtn; | ||
| 19 | - | ||
| 20 | @end | 17 | @end |
| 21 | 18 | ||
| 22 | @implementation HomeViewController | 19 | @implementation HomeViewController |
| 23 | 20 | ||
| 24 | -- (void)viewWillAppear:(BOOL)animated | ||
| 25 | -{ | ||
| 26 | - [super viewWillAppear:animated]; | ||
| 27 | - [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn]; | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | -- (void)viewWillDisappear:(BOOL)animated | ||
| 31 | -{ | ||
| 32 | - [super viewWillDisappear:animated]; | ||
| 33 | - [self.interactionBtn removeFromSuperview]; | ||
| 34 | -} | ||
| 35 | - | ||
| 36 | - (void)viewDidLoad { | 21 | - (void)viewDidLoad { |
| 37 | [super viewDidLoad]; | 22 | [super viewDidLoad]; |
| 38 | // Do any additional setup after loading the view. | 23 | // Do any additional setup after loading the view. |
| @@ -50,8 +35,6 @@ | @@ -50,8 +35,6 @@ | ||
| 50 | [UGCLiveBtn setTitle:@"UGC直播" forState:UIControlStateNormal]; | 35 | [UGCLiveBtn setTitle:@"UGC直播" forState:UIControlStateNormal]; |
| 51 | [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside]; | 36 | [UGCLiveBtn addTarget:self action:@selector(UGCLiveAction) forControlEvents:UIControlEventTouchUpInside]; |
| 52 | [self.view addSubview:UGCLiveBtn]; | 37 | [self.view addSubview:UGCLiveBtn]; |
| 53 | - | ||
| 54 | - [[UIApplication sharedApplication].keyWindow addSubview:self.interactionBtn]; | ||
| 55 | } | 38 | } |
| 56 | 39 | ||
| 57 | - (void)liveAction | 40 | - (void)liveAction |
| @@ -67,28 +50,6 @@ | @@ -67,28 +50,6 @@ | ||
| 67 | [self.navigationController pushViewController:UGCLiveVC animated:YES]; | 50 | [self.navigationController pushViewController:UGCLiveVC animated:YES]; |
| 68 | } | 51 | } |
| 69 | 52 | ||
| 70 | -- (void)interactionAction | ||
| 71 | -{ | ||
| 72 | - LVCInteractionController *intVC = [[LVCInteractionController alloc] init]; | ||
| 73 | - self.navigationController.navigationBar.hidden = YES; | ||
| 74 | - [self.navigationController pushViewController:intVC animated:YES]; | ||
| 75 | -} | ||
| 76 | - | ||
| 77 | - | ||
| 78 | -- (UIButton *)interactionBtn | ||
| 79 | -{ | ||
| 80 | - if (!_interactionBtn) | ||
| 81 | - { | ||
| 82 | - UIButton *interactionBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
| 83 | - interactionBtn.frame = CGRectMake(200, 400, 50, 30); | ||
| 84 | - [interactionBtn setTitle:@"互动" forState:UIControlStateNormal]; | ||
| 85 | - [interactionBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | ||
| 86 | - [interactionBtn addTarget:self action:@selector(interactionAction) forControlEvents:UIControlEventTouchUpInside]; | ||
| 87 | - _interactionBtn = interactionBtn; | ||
| 88 | - } | ||
| 89 | - return _interactionBtn; | ||
| 90 | -} | ||
| 91 | - | ||
| 92 | - (void)didReceiveMemoryWarning { | 53 | - (void)didReceiveMemoryWarning { |
| 93 | [super didReceiveMemoryWarning]; | 54 | [super didReceiveMemoryWarning]; |
| 94 | // Dispose of any resources that can be recreated. | 55 | // Dispose of any resources that can be recreated. |
LiveVideoCloud/LiveVideoCloud/UtilKits/Const/ZXConst.m
LiveVideoCloud/LiveVideoCloud/UtilKits/Macro/Macros/NotificationMacro.h
| @@ -16,5 +16,4 @@ | @@ -16,5 +16,4 @@ | ||
| 16 | /** 标题按钮重复点击的通知 */ | 16 | /** 标题按钮重复点击的通知 */ |
| 17 | static NSString *const ZXTitleButtonDidRepeatClickNotification = @"ZXTitleButtonDidRepeatClickNotification"; | 17 | static NSString *const ZXTitleButtonDidRepeatClickNotification = @"ZXTitleButtonDidRepeatClickNotification"; |
| 18 | 18 | ||
| 19 | - | ||
| 20 | #endif /* NotificationMacro_h */ | 19 | #endif /* NotificationMacro_h */ |
LiveVideoCloud/LiveVideoCloud/UtilKits/Macro/Macros/UserDefaultKeyMacro.h
| @@ -16,6 +16,7 @@ | @@ -16,6 +16,7 @@ | ||
| 16 | /** 用户搜索信息key */ | 16 | /** 用户搜索信息key */ |
| 17 | static NSString *const UserInfoAllKeys = @"UserInfoAllKeys"; | 17 | static NSString *const UserInfoAllKeys = @"UserInfoAllKeys"; |
| 18 | 18 | ||
| 19 | - | 19 | +/** 当前键盘监听者 */ |
| 20 | +static NSString *const keyboard = @"keyboard"; | ||
| 20 | 21 | ||
| 21 | #endif /* UserDefaultKeyMacro_h */ | 22 | #endif /* UserDefaultKeyMacro_h */ |