Commit 51b5c4a4fd34cbbc937e7d80df1c9cff6fe68a56

Authored by 王军波
1 parent d234bcca

UGC退出

LiveVideoCloud/Classes/Sections/UGCSections/Controller/LVCUGCLivePlayerController.m
... ... @@ -117,29 +117,31 @@
117 117 NSLog(@"dealloc");
118 118 }
119 119  
120   -- (void)quitBtnClick { // 退出
  120 +- (void)quitBtnClick:(UIButton *)btn { // 退出
121 121  
122 122 [_player stop];
123   -// if (self.navigationController.viewControllers.count > 2) {//判断
124   -// [self.navigationController popViewControllerAnimated:YES];
125   -// }
126   -
127   - [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_liveBaseView.roomId success:^(NSString *targetId) {
128   - NSLog(@"quit Success");
129   - } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
130   - NSLog(@"quit Failure");
131   - }];
132   -
133   - [_liveBaseView clearChatAndGiftData];
134 123  
135   - for (UIViewController *controller in self.navigationController.viewControllers) {
136   - if ([controller isKindOfClass:[MineLiveController class]]) {
137   - MineLiveController *revise =(MineLiveController *)controller;
138   - [self.navigationController popToViewController:revise animated:YES];
139   - }
140   - else if ([controller isKindOfClass:[LVCUGCLiveListController class]]) {
141   - LVCUGCLiveListController *revise =(LVCUGCLiveListController *)controller;
142   - [self.navigationController popToViewController:revise animated:YES];
  124 + if ((btn.tag == 1002) || (btn.tag == 1003)) {
  125 + [self.navigationController popViewControllerAnimated:YES];
  126 + } else if (btn.tag == 1001) {
  127 +
  128 + [[CNLiveChatManager sharedCNLiveChatManager] quitChatRoom:_liveBaseView.roomId success:^(NSString *targetId) {
  129 + NSLog(@"quit Success");
  130 + } error:^(CNLiveChatErrorCode errors, NSString *targetId) {
  131 + NSLog(@"quit Failure");
  132 + }];
  133 +
  134 + [_liveBaseView clearChatAndGiftData];
  135 +
  136 + for (UIViewController *controller in self.navigationController.viewControllers) {
  137 + if ([controller isKindOfClass:[MineLiveController class]]) {
  138 + MineLiveController *revise =(MineLiveController *)controller;
  139 + [self.navigationController popToViewController:revise animated:YES];
  140 + }
  141 + else if ([controller isKindOfClass:[LVCUGCLiveListController class]]) {
  142 + LVCUGCLiveListController *revise =(LVCUGCLiveListController *)controller;
  143 + [self.navigationController popToViewController:revise animated:YES];
  144 + }
143 145 }
144 146 }
145 147 }
... ... @@ -669,13 +671,6 @@
669 671 }];
670 672 }
671 673  
672   -#pragma mark - Button Action !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
673   -- (void)backToList {
674   -
675   - [_player stop];
676   - [self.navigationController popViewControllerAnimated:YES];
677   -}
678   -
679 674 #pragma mark - GetMethod !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
680 675 - (LiveBaseView *)liveBaseView
681 676 {
... ... @@ -685,7 +680,8 @@
685 680 _liveBaseView.jumpType = JumpControllerTypePush;
686 681 _liveBaseView.viewController = self;
687 682 _liveBaseView.backgroundColor = [UIColor clearColor];
688   - [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick) forControlEvents:UIControlEventTouchUpInside];
  683 + _liveBaseView.closeBtn.tag = 1001;
  684 + [_liveBaseView.closeBtn addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
689 685 }
690 686 return _liveBaseView;
691 687 }
... ... @@ -695,7 +691,8 @@
695 691 if (!_bgView) {
696 692 _bgView = [[LVCUGCBackgroundView alloc] initWithFrame:self.view.bounds];
697 693 _bgView.hidden = YES;
698   - [_bgView.backButton addTarget:self action:@selector(backToList) forControlEvents:UIControlEventTouchUpInside];
  694 + _bgView.backButton.tag = 1002;
  695 + [_bgView.backButton addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
699 696 }
700 697 return _bgView;
701 698 }
... ... @@ -749,7 +746,8 @@
749 746 _vodPlayerQuitBtn.frame = CGRectMake(SCREEN_WIDTH - 50, 50, 40, 40);
750 747 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseNormal"] forState:UIControlStateNormal];
751 748 [_vodPlayerQuitBtn setImage:[UIImage imageNamed:@"LiveCloseTouch"] forState:UIControlStateHighlighted];
752   - [_vodPlayerQuitBtn addTarget:self action:@selector(backToList) forControlEvents:UIControlEventTouchUpInside];
  749 + _vodPlayerQuitBtn.tag = 1003;
  750 + [_vodPlayerQuitBtn addTarget:self action:@selector(quitBtnClick:) forControlEvents:UIControlEventTouchUpInside];
753 751 }
754 752 return _vodPlayerQuitBtn;
755 753 }
... ...