Commit b081d723846c2c632ebca2d0637a2a7ffcc49de8

Authored by yanglingyu
1 parent 18b43dc4

no message

CNLiveVideoClassifyKit.podspec
... ... @@ -28,7 +28,7 @@ TODO: Add long description of the pod here.
28 28 s.source = { :git => 'http://bj.gitlab.cnlive.com/ios-team/CNLiveVideoClassifyKit.git', :tag => s.version.to_s }
29 29 # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
30 30  
31   - s.ios.deployment_target = '9.0'
  31 + s.ios.deployment_target = '10.0'
32 32  
33 33 s.source_files = 'CNLiveVideoClassifyKit/Classes/**/*'
34 34  
... ... @@ -45,6 +45,7 @@ TODO: Add long description of the pod here.
45 45 s.dependency 'CNLiveBaseClass'
46 46 s.dependency 'CNLiveUserManagement'
47 47 s.dependency 'CNLiveCommonCategory'
  48 + s.dependency 'CNLiveCWebViewModule'
48 49 s.dependency 'CNLiveTripartiteManagement/SDWebImage'
49 50 s.dependency 'CNLiveTripartiteManagement/Masonry'
50 51 s.dependency 'CNLiveTripartiteManagement/YYKit'
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
... ... @@ -6,7 +6,8 @@
6 6 // 分类控制器根类
7 7  
8 8 #import "CNCategoryBaseViewController.h"
9   -#import "ListViewController.h"
  9 +#import "CNListViewController.h"
  10 +
10 11  
11 12 @interface CNCategoryBaseViewController ()
12 13  
... ... @@ -37,6 +38,7 @@
37 38 [super viewWillAppear:animated];
38 39 self.navigationController.interactivePopGestureRecognizer.enabled = YES;
39 40 self.navigationHidden = YES;
  41 +
40 42 }
41 43  
42 44 #pragma mark - Public
... ... @@ -65,7 +67,7 @@
65 67  
66 68 -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index
67 69 {
68   - ListViewController *list = [ListViewController new];
  70 + CNListViewController *list = [CNListViewController new];
69 71 return list;
70 72 }
71 73  
... ...
CNLiveVideoClassifyKit/Classes/Controller/ListViewController.h renamed to CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.h
1 1 //
2   -// ListViewController.h
  2 +// CNListViewController.h
3 3 // CNLiveVideoClassifyKit
4 4 //
5 5 // Created by CNLive on 2021/8/12.
6 6 //
7 7  
8 8 #import <UIKit/UIKit.h>
9   -
  9 +#import <CNLiveBaseClass/CNLiveBaseViewController.h>
  10 +@class CNCategoryGetChannelModel;
10 11  
11 12 NS_ASSUME_NONNULL_BEGIN
12 13  
13   -@interface ListViewController : UIViewController<JXCategoryListContentViewDelegate>
  14 +@interface CNListViewController : CNLiveBaseViewController<JXCategoryListContentViewDelegate>
14 15 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *);
15   -@property (nonatomic, copy) void (^willBeginDragging)(UIScrollView *);
16   -@property (nonatomic, copy) void (^didEndDragging)(UIScrollView *);
  16 +@property (nonatomic, copy) void (^willBeginDragging)(CGFloat);
17 17  
18   -- (void)stopScrolling;
  18 +-(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black;
19 19 @end
20 20  
21 21 NS_ASSUME_NONNULL_END
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.m 0 → 100644
  1 +//
  2 +// CNListViewController.m
  3 +// CNLiveVideoClassifyKit
  4 +//
  5 +// Created by CNLive on 2021/8/12.
  6 +//
  7 +
  8 +#import "CNListViewController.h"
  9 +#import <CNLiveCWebViewModule/CNLiveCWebViewModule.h>
  10 +#import <CNLiveCWebViewModule/CNLiveSubWebViewController.h>
  11 +#import "CNCategoryGetChannelModel.h"
  12 +
  13 +@interface CNListViewController ()<UIScrollViewDelegate>
  14 +{
  15 + NSString *_thirdUrl;
  16 + NSDictionary *_paramDic;
  17 +
  18 +}
  19 +@end
  20 +
  21 +@implementation CNListViewController
  22 +-(instancetype)initWithModel:(CNCategoryGetChannelModel *)model black:(BOOL)black
  23 +{
  24 + self = [super init];
  25 + if (self) {
  26 + _thirdUrl = model.thirdUrl;
  27 + _paramDic = @{
  28 + @"title": model.showName,
  29 + @"intercept": @(YES),
  30 + @"isBlack":@(black)
  31 +
  32 + };
  33 + }
  34 + return self;
  35 +}
  36 +- (void)viewDidLoad {
  37 + [super viewDidLoad];
  38 + self.view.backgroundColor = [UIColor whiteColor];
  39 + self.navigationHidden = YES;
  40 +}
  41 +
  42 +-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
  43 +{
  44 + if ([keyPath isEqualToString:@"contentOffset"]) {
  45 + CGPoint oldPoint = [change[NSKeyValueChangeOldKey] CGPointValue];
  46 + !self.willBeginDragging ?:self.willBeginDragging(oldPoint.y);
  47 + UIScrollView *scrollView = (UIScrollView *)object;
  48 + !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(scrollView);
  49 +
  50 + }
  51 +}
  52 +#pragma mark - JXCategoryListContentViewDelegate
  53 +
  54 +/**
  55 + 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」
  56 + */
  57 +- (UIView *)listView {
  58 + CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_thirdUrl
  59 + ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
  60 + for (UIView*subView in subVC.view.subviews) {
  61 + if ([subView isKindOfClass:[WKWebView class]]) {
  62 + WKWebView *webView = (WKWebView *)subView;
  63 + [webView.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld context:NULL];
  64 + }
  65 + }
  66 +
  67 + return subVC.view;
  68 +}
  69 +/*
  70 +#pragma mark - Navigation
  71 +
  72 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  73 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  74 + // Get the new view controller using [segue destinationViewController].
  75 + // Pass the selected object to the new view controller.
  76 +}
  77 +*/
  78 +
  79 +@end
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
... ... @@ -9,8 +9,9 @@
9 9 #import <UIKit/UIKit.h>
10 10 #import "CNCustomChannelListView.h"
11 11 #import "CNCategoryGetChannelModel.h"
12   -#import "ListViewController.h"
  12 +#import "CNListViewController.h"
13 13 #import "CNLiveSubSegmentController.h"
  14 +#import <CNLiveCWebViewModule/CNLiveWebViewJumpBridge.h>
14 15  
15 16 @interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate>
16 17  
... ... @@ -43,7 +44,14 @@ static CGFloat moveHeight = 50;
43 44 - (void)viewDidLoad {
44 45 [super viewDidLoad];
45 46 self.topBgImgHeight = kStatusHeight+100;
46   - [self.view insertSubview:self.topBgImg atIndex:0];
  47 + [self.view addSubview:self.topBgImg];
  48 + [self.view sendSubviewToBack:self.topBgImg];
  49 + if ([CNUserShareManager isLogin]) {
  50 + [self.myCategoryView addSubview:self.customChannelsBtn];
  51 + }else
  52 + {
  53 + [self.myCategoryView addSubview:self.loginBtn];
  54 + }
47 55  
48 56 for (int i = 0;i<self.imageNames.count;i++) {
49 57 NSURL *url = [NSURL URLWithString:self.imageNames[i]];
... ... @@ -68,59 +76,86 @@ static CGFloat moveHeight = 50;
68 76 self.myCategoryView.cellWidthZoomEnabled = YES;
69 77 self.myCategoryView.cellWidthZoomScale = 1.3;
70 78 self.myCategoryView.imageSize = CGSizeMake(56, 18);
71   - [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:0];
  79 + [self updateSelectColors:0];
  80 + [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:0 unselectIndex:0];
72 81  
73 82 self.listContainerView.translatesAutoresizingMaskIntoConstraints = NO;
74   -// //增加上下滑动手势
75   -// UISwipeGestureRecognizer *recognizerUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
76   -// [recognizerUp setDirection:UISwipeGestureRecognizerDirectionUp];
77   -// [self.listContainerView addGestureRecognizer:recognizerUp];
78   -//
79   -// UISwipeGestureRecognizer *recognizerDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)];
80   -// [recognizerDown setDirection:UISwipeGestureRecognizerDirectionDown];
81   -// [self.listContainerView addGestureRecognizer:recognizerDown];
82 83 // Do any additional setup after loading the view.
83 84 }
84 85  
85 86 -(void)viewDidLayoutSubviews
86 87 {
87 88 [super viewDidLayoutSubviews];
88   - [self.myCategoryView.heightAnchor constraintEqualToConstant:[self preferredCategoryViewHeight]].active = YES;
89   - [self.myCategoryView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = YES;
90   - [self.myCategoryView.topAnchor constraintEqualToAnchor:self.myCategoryView.topAnchor].active = YES;
91   - [self.myCategoryView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor].active = YES;
92   - [self.myCategoryView.bottomAnchor constraintEqualToAnchor:self.listContainerView.topAnchor].active = YES;
93   - [self.listContainerView.leftAnchor constraintEqualToAnchor:self.view.leftAnchor].active = YES;
94   - [self.listContainerView.rightAnchor constraintEqualToAnchor:self.view.rightAnchor].active = YES;
95   - CGFloat listContainerViewHeight = self.view.bounds.size.height;
96   - [self.listContainerView.heightAnchor constraintEqualToConstant:listContainerViewHeight].active = YES;
  89 + self.listContainerView.frame = CGRectMake(0,self.myCategoryView.bottom, kScreenWidth, self.view.height -kStatusHeight);
  90 + if ([CNUserShareManager isLogin]) {
  91 + self.myCategoryView.width = kScreenWidth - 45;
  92 + self.customChannelsBtn.centerY = self.myCategoryView.height/2;
  93 + self.customChannelsBtn.right = kScreenWidth - 18;
  94 + }else
  95 + {
  96 + self.myCategoryView.width = kScreenWidth - 70;
  97 + self.loginBtn.centerY = self.myCategoryView.height/2;
  98 + self.loginBtn.right = kScreenWidth - 11;
  99 + }
97 100  
98 101 }
99 102  
100 103 -(void)viewDidAppear:(BOOL)animated
101 104 {
102 105 [super viewDidAppear:animated];
  106 +
103 107 }
104 108  
  109 +-(void)viewDidDisappear:(BOOL)animated
  110 +{
  111 + [super viewDidDisappear: animated];
  112 +
  113 +}
  114 +
  115 +
105 116 -(UIStatusBarStyle)preferredStatusBarStyle
106 117 {
107 118 if (self.currentAtatusColor.intValue == 0) {
  119 + self.customChannelsBtn.selected = YES;
108 120 return UIStatusBarStyleLightContent;
109 121 }else
110 122 {
  123 + self.customChannelsBtn.selected = NO;
111 124 return UIStatusBarStyleDefault;
112 125 }
113 126  
114 127 }
115   -#pragma mark - Method
116 128  
  129 +#pragma mark - Action
  130 +// 点击定制频道按钮进入定制
  131 +- (void)customAction:(UIButton *)sender {
  132 +
  133 +}
  134 +// 登录
  135 +- (void)loginAction:(UIButton *)sender {
  136 +
  137 +}
  138 +#pragma mark - Method
  139 +-(void)updateSelectColors:(NSInteger)index
  140 +{
  141 + NSString *backgroundImage = [self.bgImages safetyObjectAtIndex:index];
  142 + [self.topBgImg sd_setImageWithURL:[NSURL URLWithString:backgroundImage]];
  143 + NSString *backgroundColor = [self.bgColors safetyObjectAtIndex:index];
  144 + self.topBgImg.backgroundColor = CNLiveColorWithHexString(backgroundColor);
  145 + self.myCategoryView.titleColor = self.textColors[index];
  146 + self.myCategoryView.titleSelectedColor = self.textColorSeleteds[index];
  147 + if (!self.currentAtatusColor || ![self.currentAtatusColor isEqualToString:self.statusBarColors[index]] ) {
  148 + self.currentAtatusColor = self.statusBarColors[index];
  149 + [self setNeedsStatusBarAppearanceUpdate];
  150 + }
  151 +}
117 152 //配置选中状态显示图片,未选中展示文字
118   -- (void)configCategoryViewWithType:(JXCategoryTitleImageType)imageType selectIndex:(NSInteger)index
  153 +- (void)configCategoryViewWithType:(JXCategoryTitleImageType)imageType selectIndex:(NSInteger)index unselectIndex:(NSInteger)unIndex
119 154 {
120 155  
121 156 NSMutableArray *types = [NSMutableArray array];
122 157 for (int i = 0; i < self.titles.count; i ++) {
123   - if (i == index) {
  158 + if (i == index || i == unIndex) {
124 159 NSURL *url = self.imageNames[i];
125 160 NSString *str = [url absoluteString];
126 161 if ([str isEqual:@""]) {
... ... @@ -132,17 +167,7 @@ static CGFloat moveHeight = 50;
132 167 [types addObject:@(JXCategoryTitleImageType_OnlyTitle)];
133 168 }
134 169 }
135   - NSString *backgroundImage = [self.bgImages safetyObjectAtIndex:index];
136   - [self.topBgImg sd_setImageWithURL:[NSURL URLWithString:backgroundImage]];
137   - NSString *backgroundColor = [self.bgColors safetyObjectAtIndex:index];
138   - self.topBgImg.backgroundColor = CNLiveColorWithHexString(backgroundColor);
139   - self.myCategoryView.titleColor = self.textColors[index];
140   - self.myCategoryView.titleSelectedColor = self.textColorSeleteds[index];
141 170 self.myCategoryView.imageTypes = types;
142   - if (!self.currentAtatusColor || ![self.currentAtatusColor isEqualToString:self.statusBarColors[index]] ) {
143   - self.currentAtatusColor = self.statusBarColors[index];
144   - [self setNeedsStatusBarAppearanceUpdate];
145   - }
146 171 for (int i = 0; i < self.titles.count; i ++) {
147 172 [self.myCategoryView reloadCellAtIndex:i];
148 173 }
... ... @@ -201,30 +226,47 @@ static CGFloat moveHeight = 50;
201 226 }
202 227 }
203 228 - (void)listScrollViewDidScroll:(UIScrollView *)scrollView {
204   - CGPoint point = CGPointZero;
205   - CGFloat offsetY = 0;
206   - if (scrollView.contentOffset.y <= 0 && self.myCategoryView.frame.origin.y != kStatusHeight) {
207   - point = [scrollView.panGestureRecognizer translationInView:scrollView];
208   - offsetY = point.y - self.lastOffsetY;
209   - }else {
210   - if ((scrollView.contentOffset.y < 0 && self.myCategoryView.frame.origin.y == kStatusHeight) || scrollView.contentOffset.y + scrollView.bounds.size.height >= scrollView.contentSize.height) {
211   - return;
  229 + CGPoint point = scrollView.contentOffset;
  230 + CGFloat offsetY = point.y - self.lastOffsetY;
  231 +
  232 + [self scrollViewUpDowm:offsetY>0?YES:NO];
  233 +}
  234 +-(void)scrollViewUpDowm:(BOOL)isUp
  235 +{
  236 + [UIView animateWithDuration:0.3 animations:^{
  237 + if (isUp) {
  238 + [self scrollViewUp];
  239 + }else
  240 + {
  241 + [self scrollViewDown];
212 242 }
213   - point = scrollView.contentOffset;
214   - offsetY = -(point.y - self.lastOffsetY);
215   - }
  243 + if ([CNUserShareManager isLogin]) {
  244 + self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY;
  245 + }else
  246 + {
  247 + self.loginBtn.centerY = self.myCategoryView.collectionView.centerY;
  248 + }
  249 + }];
  250 +}
216 251  
217   - if (self.lastOffsetY == 0) {
218   - self.lastOffsetY = point.y;
  252 +-(void)scrollViewUp{
  253 + if (self.topBgImg.top<0) {
219 254 return;
220 255 }
221   - CGRect naviBarFrame = self.myCategoryView.frame;
222   - naviBarFrame.origin.y += offsetY;
223   - naviBarFrame.origin.y = MAX(-[self preferredCategoryViewHeight], MIN(kStatusHeight, naviBarFrame.origin.y));
224   - self.myCategoryView.frame = naviBarFrame;
225   - double percent = (naviBarFrame.origin.y + [self preferredCategoryViewHeight])/[self preferredCategoryViewHeight];
226   - self.myCategoryView.alpha = percent;
227   - self.lastOffsetY = point.y;
  256 + [self managerScrollView:YES];
  257 + self.topBgImg.top -= moveHeight;
  258 + self.myCategoryView.collectionView.top = -50-kStatusHeight;
  259 + self.listContainerView.top = kStatusHeight;
  260 +}
  261 +-(void)scrollViewDown{
  262 + if (self.topBgImg.top==0) {
  263 + return;
  264 + }
  265 + [self managerScrollView:NO];
  266 + self.topBgImg.top += moveHeight;
  267 + self.myCategoryView.collectionView.top = 0;
  268 + self.listContainerView.top = self.myCategoryView.bottom;
  269 +
228 270 }
229 271  
230 272 -(void)managerScrollView:(BOOL)enabled
... ... @@ -243,21 +285,34 @@ static CGFloat moveHeight = 50;
243 285 }
244 286 }
245 287 #pragma mark - JXCategoryViewDelegate
  288 +// 正在滚动中的回调,这里调整背景图片的 alpha 透明度
  289 +- (void)categoryView:(JXCategoryBaseView *)categoryView scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio {
  290 + [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:leftIndex unselectIndex:rightIndex];
  291 +}
  292 +
246 293  
247 294 - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
248 295 NSLog(@"%@", NSStringFromSelector(_cmd));
249 296 self.currentIndex = index;
250 297 // 侧滑手势处理
251 298 self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
252   - [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:index];
  299 + [self updateSelectColors:index];
  300 + [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:index unselectIndex:index];
253 301 }
254 302 #pragma mark - JXCategoryListContainerViewDelegate
255 303 -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index
256 304 {
257 305 CNCategoryGetChannelModel *model = self.dataArray[index];
  306 + BOOL isBlack = NO;
  307 + if (CNLiveStringIsEmpty(model.statusBarColor)) {
  308 + isBlack = YES;
  309 + } else {
  310 + isBlack = [model.statusBarColor boolValue];//1 黑色
  311 + }
258 312 if (model.pageStyleList.count>0) {
259 313 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight);
260 314 CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model];
  315 + subVC.isBlack = isBlack;
261 316 weakself
262 317 subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
263 318 [weakSelf listScrollViewDidScroll:scrollView];
... ... @@ -265,13 +320,17 @@ static CGFloat moveHeight = 50;
265 320 subVC.willBeginDragging = ^(CGFloat lastOffsetY) {
266 321 weakSelf.lastOffsetY = lastOffsetY;
267 322 };
268   - subVC.didEndDragging = ^(CGFloat lastOffsetY) {
269   - weakSelf.lastOffsetY = lastOffsetY;
270   - };
271 323 return subVC;
272 324 }
273 325 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50);
274   - ListViewController *list = [ListViewController new];
  326 + CNListViewController *list = [[CNListViewController alloc] initWithModel:model black:isBlack];
  327 + weakself
  328 + list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
  329 + [weakSelf listScrollViewDidScroll:scrollView];
  330 + };
  331 + list.willBeginDragging = ^(CGFloat lastOffsetY) {
  332 + weakSelf.lastOffsetY = lastOffsetY;
  333 + };
275 334 return list;
276 335 }
277 336 #pragma mark - Public
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.h
... ... @@ -11,10 +11,12 @@
11 11 NS_ASSUME_NONNULL_BEGIN
12 12  
13 13 @interface CNLiveSubSegmentController : CNCategoryBaseViewController<JXCategoryListContentViewDelegate>
  14 +
  15 +@property (nonatomic, assign) BOOL isBlack;
  16 +
14 17 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model;
15 18 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *);
16 19 @property (nonatomic, copy) void (^willBeginDragging)(CGFloat );
17   -@property (nonatomic, copy) void (^didEndDragging)(CGFloat );
18 20  
19 21 //- (void)stopScrolling;
20 22  
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
... ... @@ -7,11 +7,11 @@
7 7  
8 8 #import "CNLiveSubSegmentController.h"
9 9 #import "CNCategoryGetChannelModel.h"
10   -#import "ListViewController.h"
  10 +#import "CNListViewController.h"
11 11  
12 12 @interface CNLiveSubSegmentController ()
13 13 @property (nonatomic, strong)JXCategoryTitleView *myCategoryView;
14   -@property (nonatomic, strong)NSArray *pageListArr;
  14 +@property (nonatomic, strong)NSArray<CNCategoryGetChannelModel*> *pageListArr;
15 15 @property (nonatomic, strong)UIColor *textColor;
16 16 @property (nonatomic, strong)UIColor *backgroundColor;
17 17 @property (nonatomic, strong)NSString *backImage;
... ... @@ -93,16 +93,14 @@
93 93  
94 94 -(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index
95 95 {
96   - ListViewController *list = [ListViewController new];
  96 + CNCategoryGetChannelModel *model = self.pageListArr[index];
  97 + CNListViewController *list = [[CNListViewController alloc] initWithModel:model black:self.isBlack];
97 98 weakself
98 99 list.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
99   - weakSelf.scrollViewDidScrollBlock(scrollView);
  100 + !weakSelf.scrollViewDidScrollBlock ?: weakSelf.scrollViewDidScrollBlock(scrollView);
100 101 };
101   - list.willBeginDragging = ^(UIScrollView * _Nonnull scrollView) {
102   - weakSelf.willBeginDragging(0);
103   - };
104   - list.didEndDragging = ^(UIScrollView * _Nonnull scrollView) {
105   - weakSelf.didEndDragging(0);
  102 + list.willBeginDragging = ^(CGFloat lastOffsetY) {
  103 + !weakSelf.willBeginDragging ?: weakSelf.willBeginDragging(lastOffsetY);
106 104 };
107 105 return list;
108 106 }
... ...
CNLiveVideoClassifyKit/Classes/Controller/ListViewController.m deleted 100644 → 0
1   -//
2   -// ListViewController.m
3   -// CNLiveVideoClassifyKit
4   -//
5   -// Created by CNLive on 2021/8/12.
6   -//
7   -
8   -#import "ListViewController.h"
9   -
10   -@interface ListViewController ()<UITableViewDataSource, UITableViewDelegate>
11   -@property (nonatomic, strong) UITableView *tableView;
12   -@end
13   -
14   -@implementation ListViewController
15   -
16   -- (void)viewDidLoad {
17   - [super viewDidLoad];
18   - self.view.backgroundColor = [UIColor whiteColor];
19   - self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
20   - if (@available(iOS 11.0, *)) {
21   - if ([self.tableView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) {
22   - self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
23   - }
24   - }
25   - self.tableView.dataSource = self;
26   - self.tableView.delegate = self;
27   - [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
28   - [self.view addSubview:self.tableView];
29   - // Do any additional setup after loading the view.
30   -}
31   -- (void)viewDidLayoutSubviews {
32   - [super viewDidLayoutSubviews];
33   -
34   - self.tableView.frame = self.view.bounds;
35   -}
36   -- (void)stopScrolling {
37   - [self.tableView setContentOffset:self.tableView.contentOffset animated:NO];
38   -}
39   -- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
40   - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
41   - cell.textLabel.text = [NSString stringWithFormat:@"row:%ld", indexPath.row];
42   - return cell;
43   -}
44   -
45   -- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
46   - return 100;
47   -}
48   -
49   -- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
50   - !self.scrollViewDidScrollBlock ?: self.scrollViewDidScrollBlock(scrollView);
51   -}
52   -
53   -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
54   - !self.willBeginDragging ?: self.willBeginDragging(scrollView);
55   -}
56   -
57   -- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
58   - !self.didEndDragging ?: self.didEndDragging(scrollView);
59   -}
60   -#pragma mark - JXCategoryListContentViewDelegate
61   -
62   -/**
63   - 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」
64   - */
65   -- (UIView *)listView {
66   - return self.view;
67   -}
68   -/*
69   -#pragma mark - Navigation
70   -
71   -// In a storyboard-based application, you will often want to do a little preparation before navigation
72   -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
73   - // Get the new view controller using [segue destinationViewController].
74   - // Pass the selected object to the new view controller.
75   -}
76   -*/
77   -
78   -@end
Example/CNLiveVideoClassifyKit.xcodeproj/project.pbxproj
... ... @@ -358,16 +358,21 @@
358 358 "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
359 359 "${BUILT_PRODUCTS_DIR}/CNLiveBaseClass/CNLiveBaseClass.framework",
360 360 "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework",
  361 + "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework",
  362 + "${BUILT_PRODUCTS_DIR}/CNLiveCWebViewModule/CNLiveCWebViewModule.framework",
361 363 "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework",
362 364 "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
363 365 "${BUILT_PRODUCTS_DIR}/CNLiveCustomControl/CNLiveCustomControl.framework",
  366 + "${BUILT_PRODUCTS_DIR}/CNLiveCustomUI/CNLiveCustomUI.framework",
364 367 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
365 368 "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework",
366 369 "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework",
367 370 "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework",
368 371 "${BUILT_PRODUCTS_DIR}/CNLiveVideoClassifyKit/CNLiveVideoClassifyKit.framework",
  372 + "${BUILT_PRODUCTS_DIR}/FWDebug/FWDebug.framework",
369 373 "${BUILT_PRODUCTS_DIR}/JXCategoryView/JXCategoryView.framework",
370 374 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
  375 + "${BUILT_PRODUCTS_DIR}/MJRefresh/MJRefresh.framework",
371 376 "${BUILT_PRODUCTS_DIR}/Masonry/Masonry.framework",
372 377 "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
373 378 "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
... ... @@ -379,16 +384,21 @@
379 384 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
380 385 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseClass.framework",
381 386 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework",
  387 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework",
  388 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCWebViewModule.framework",
382 389 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework",
383 390 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
384 391 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomControl.framework",
  392 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCustomUI.framework",
385 393 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
386 394 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework",
387 395 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework",
388 396 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework",
389 397 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveVideoClassifyKit.framework",
  398 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FWDebug.framework",
390 399 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXCategoryView.framework",
391 400 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
  401 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJRefresh.framework",
392 402 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Masonry.framework",
393 403 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
394 404 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
... ...
Example/Podfile
1 1 use_frameworks!
2 2  
3   -platform :ios, '9.0'
  3 +platform :ios, '10.0'
4 4 source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
5 5 source 'http://bj.gitlab.cnlive.com/ios-team/CNLiveRepos.git'
6 6 #source 'http://bj.gitlab.cnlive.com/DSIOSTeam/DSSpecRepos.git'
... ... @@ -8,6 +8,8 @@ target &#39;CNLiveVideoClassifyKit_Example&#39; do
8 8 pod 'CNLiveVideoClassifyKit', :path => '../'
9 9 pod 'CNLiveEnvironment'
10 10 pod 'CNLiveRequestBastKit'
  11 + pod 'CNLiveCWebViewModule'
  12 + pod 'FWDebug', :configurations => ['Debug']
11 13 #依赖三方私有库,如果里面有.a的时候加上这个
12 14 pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
13 15 ############################################ #删除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件
... ...