Commit 357658829e7948d4a20618fe8897e8dd969ece65
1 parent
20967c59
no message
Showing
5 changed files
with
19 additions
and
57 deletions
CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.h renamed to CNLiveListManager.h
| 1 | // | 1 | // |
| 2 | -// CNListViewController.h | 2 | +// CNLiveListManager.h |
| 3 | // CNLiveVideoClassifyKit | 3 | // CNLiveVideoClassifyKit |
| 4 | // | 4 | // |
| 5 | -// Created by CNLive on 2021/8/12. | 5 | +// Created by CNLive on 2021/9/8. |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | -#import <UIKit/UIKit.h> | ||
| 9 | -#import <CNLiveBaseClass/CNLiveBaseViewController.h> | 8 | +#import <Foundation/Foundation.h> |
| 10 | @class CNCategoryGetChannelModel; | 9 | @class CNCategoryGetChannelModel; |
| 11 | 10 | ||
| 12 | NS_ASSUME_NONNULL_BEGIN | 11 | NS_ASSUME_NONNULL_BEGIN |
| 13 | 12 | ||
| 14 | -@interface CNListViewController : CNLiveBaseViewController<JXCategoryListContentViewDelegate> | 13 | +@interface CNLiveListManager : NSObject<JXCategoryListContentViewDelegate> |
| 15 | @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *); | 14 | @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *); |
| 16 | @property (nonatomic, copy) void (^willBeginDragging)(CGFloat); | 15 | @property (nonatomic, copy) void (^willBeginDragging)(CGFloat); |
| 17 | 16 |
CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.m renamed to CNLiveListManager.m
| 1 | // | 1 | // |
| 2 | -// CNListViewController.m | 2 | +// CNLiveListManager.m |
| 3 | // CNLiveVideoClassifyKit | 3 | // CNLiveVideoClassifyKit |
| 4 | // | 4 | // |
| 5 | -// Created by CNLive on 2021/8/12. | 5 | +// Created by CNLive on 2021/9/8. |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | -#import "CNListViewController.h" | 8 | +#import "CNLiveListManager.h" |
| 9 | +#import "CNCategoryGetChannelModel.h" | ||
| 9 | #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h> | 10 | #import <CNLiveCWebViewModule/CNLiveCWebViewModule.h> |
| 10 | #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h> | 11 | #import <CNLiveCWebViewModule/CNLiveSubWebViewController.h> |
| 11 | -#import "CNCategoryGetChannelModel.h" | ||
| 12 | 12 | ||
| 13 | -@interface CNListViewController ()<UIScrollViewDelegate> | 13 | +@interface CNLiveListManager() |
| 14 | { | 14 | { |
| 15 | - NSString *_thirdUrl; | ||
| 16 | NSDictionary *_paramDic; | 15 | NSDictionary *_paramDic; |
| 17 | - CNLiveSubWebViewController *subVC; | ||
| 18 | - | 16 | + CNCategoryGetChannelModel *_model; |
| 19 | } | 17 | } |
| 20 | @end | 18 | @end |
| 21 | 19 | ||
| 22 | -@implementation CNListViewController | 20 | +@implementation CNLiveListManager |
| 23 | -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black | 21 | -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black |
| 24 | { | 22 | { |
| 25 | self = [super init]; | 23 | self = [super init]; |
| 26 | if (self) { | 24 | if (self) { |
| 27 | - _thirdUrl = model.thirdUrl; | 25 | + _model = model; |
| 28 | _paramDic = @{ | 26 | _paramDic = @{ |
| 29 | @"title": model.showName, | 27 | @"title": model.showName, |
| 30 | @"intercept": @(YES), | 28 | @"intercept": @(YES), |
| @@ -34,39 +32,14 @@ | @@ -34,39 +32,14 @@ | ||
| 34 | } | 32 | } |
| 35 | return self; | 33 | return self; |
| 36 | } | 34 | } |
| 37 | -- (void)viewDidLoad { | ||
| 38 | - [super viewDidLoad]; | ||
| 39 | - self.view.backgroundColor = [UIColor whiteColor]; | ||
| 40 | - self.navigationHidden = YES; | ||
| 41 | -} | ||
| 42 | --(void)dealloc | ||
| 43 | -{ | ||
| 44 | -// for (UIView*subView in subVC.view.subviews) { | ||
| 45 | -// if ([subView isKindOfClass:[WKWebView class]]) { | ||
| 46 | -// WKWebView *webView = (WKWebView *)subView; | ||
| 47 | -// [webView.scrollView removeObserver:self forKeyPath:@"contentOffset"]; | ||
| 48 | -// } | ||
| 49 | -// } | ||
| 50 | - | ||
| 51 | -} | ||
| 52 | 35 | ||
| 53 | --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context | ||
| 54 | -{ | ||
| 55 | - if ([keyPath isEqualToString:@"contentOffset"]) { | ||
| 56 | - CGPoint oldPoint = [change[NSKeyValueChangeOldKey] CGPointValue]; | ||
| 57 | - !self.willBeginDragging ?:self.willBeginDragging(oldPoint.y); | ||
| 58 | - UIScrollView *scrollView = (UIScrollView *)object; | ||
| 59 | - !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(scrollView); | ||
| 60 | - | ||
| 61 | - } | ||
| 62 | -} | ||
| 63 | #pragma mark - JXCategoryListContentViewDelegate | 36 | #pragma mark - JXCategoryListContentViewDelegate |
| 64 | 37 | ||
| 65 | /** | 38 | /** |
| 66 | 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」 | 39 | 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」 |
| 67 | */ | 40 | */ |
| 68 | - (UIView *)listView { | 41 | - (UIView *)listView { |
| 69 | - subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_thirdUrl | 42 | + CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_model.thirdUrl |
| 70 | ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden]; | 43 | ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden]; |
| 71 | // for (UIView*subView in subVC.view.subviews) { | 44 | // for (UIView*subView in subVC.view.subviews) { |
| 72 | // if ([subView isKindOfClass:[WKWebView class]]) { | 45 | // if ([subView isKindOfClass:[WKWebView class]]) { |
| @@ -77,14 +50,4 @@ | @@ -77,14 +50,4 @@ | ||
| 77 | 50 | ||
| 78 | return subVC.view; | 51 | return subVC.view; |
| 79 | } | 52 | } |
| 80 | -/* | ||
| 81 | -#pragma mark - Navigation | ||
| 82 | - | ||
| 83 | -// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
| 84 | -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | ||
| 85 | - // Get the new view controller using [segue destinationViewController]. | ||
| 86 | - // Pass the selected object to the new view controller. | ||
| 87 | -} | ||
| 88 | -*/ | ||
| 89 | - | ||
| 90 | @end | 53 | @end |
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
| @@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
| 6 | // 分类控制器根类 | 6 | // 分类控制器根类 |
| 7 | 7 | ||
| 8 | #import "CNCategoryBaseViewController.h" | 8 | #import "CNCategoryBaseViewController.h" |
| 9 | -#import "CNListViewController.h" | 9 | +#import "CNLiveListManager.h" |
| 10 | 10 | ||
| 11 | 11 | ||
| 12 | @interface CNCategoryBaseViewController () | 12 | @interface CNCategoryBaseViewController () |
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | 63 | ||
| 64 | -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index | 64 | -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index |
| 65 | { | 65 | { |
| 66 | - CNListViewController *list = [CNListViewController new]; | 66 | + CNLiveListManager *list = [CNLiveListManager new]; |
| 67 | return list; | 67 | return list; |
| 68 | } | 68 | } |
| 69 | 69 |
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | #import <UIKit/UIKit.h> | 9 | #import <UIKit/UIKit.h> |
| 10 | #import "CNCustomChannelListView.h" | 10 | #import "CNCustomChannelListView.h" |
| 11 | #import "CNCategoryGetChannelModel.h" | 11 | #import "CNCategoryGetChannelModel.h" |
| 12 | -#import "CNListViewController.h" | 12 | +#import "CNLiveListManager.h" |
| 13 | #import "CNLiveSubSegmentController.h" | 13 | #import "CNLiveSubSegmentController.h" |
| 14 | #import <CNLiveCWebViewModule/CNLiveWebViewJumpBridge.h> | 14 | #import <CNLiveCWebViewModule/CNLiveWebViewJumpBridge.h> |
| 15 | 15 | ||
| @@ -524,7 +524,7 @@ static CGFloat moveHeight = 50; | @@ -524,7 +524,7 @@ static CGFloat moveHeight = 50; | ||
| 524 | return subVC; | 524 | return subVC; |
| 525 | } | 525 | } |
| 526 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); | 526 | self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50); |
| 527 | - CNListViewController *list = [[CNListViewController alloc] initWithModel:model black:isBlack]; | 527 | + CNLiveListManager *list = [[CNLiveListManager alloc] initWithModel:model black:isBlack]; |
| 528 | weakself | 528 | weakself |
| 529 | list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { | 529 | list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { |
| 530 | [weakSelf listScrollViewDidScroll:scrollView]; | 530 | [weakSelf listScrollViewDidScroll:scrollView]; |
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | 7 | ||
| 8 | #import "CNLiveSubSegmentController.h" | 8 | #import "CNLiveSubSegmentController.h" |
| 9 | #import "CNCategoryGetChannelModel.h" | 9 | #import "CNCategoryGetChannelModel.h" |
| 10 | -#import "CNListViewController.h" | 10 | +#import "CNLiveListManager.h" |
| 11 | 11 | ||
| 12 | @interface CNLiveSubSegmentController () | 12 | @interface CNLiveSubSegmentController () |
| 13 | @property (nonatomic, strong)JXCategoryTitleView *myCategoryView; | 13 | @property (nonatomic, strong)JXCategoryTitleView *myCategoryView; |
| @@ -140,7 +140,7 @@ | @@ -140,7 +140,7 @@ | ||
| 140 | -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index | 140 | -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index |
| 141 | { | 141 | { |
| 142 | CNCategoryGetChannelModel *model = self.pageListArr[index]; | 142 | CNCategoryGetChannelModel *model = self.pageListArr[index]; |
| 143 | - CNListViewController *list = [[CNListViewController alloc] initWithModel:model black:self.isBlack]; | 143 | + CNLiveListManager *list = [[CNLiveListManager alloc] initWithModel:model black:self.isBlack]; |
| 144 | weakself | 144 | weakself |
| 145 | list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { | 145 | list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) { |
| 146 | !weakSelf.scrollViewDidScrollBlock ?: weakSelf.scrollViewDidScrollBlock(scrollView); | 146 | !weakSelf.scrollViewDidScrollBlock ?: weakSelf.scrollViewDidScrollBlock(scrollView); |