Commit 3d9e36a90ea8e0f805a08a0ebf6ef9826e0c67aa

Authored by yanglingyu
1 parent b081d723

no message

CNLiveVideoClassifyKit.podspec
@@ -49,5 +49,6 @@ TODO: Add long description of the pod here. @@ -49,5 +49,6 @@ TODO: Add long description of the pod here.
49 s.dependency 'CNLiveTripartiteManagement/SDWebImage' 49 s.dependency 'CNLiveTripartiteManagement/SDWebImage'
50 s.dependency 'CNLiveTripartiteManagement/Masonry' 50 s.dependency 'CNLiveTripartiteManagement/Masonry'
51 s.dependency 'CNLiveTripartiteManagement/YYKit' 51 s.dependency 'CNLiveTripartiteManagement/YYKit'
  52 + s.dependency 'CNLiveTripartiteManagement/QMUIKit'
52 53
53 end 54 end
CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifySearch@2x.png 0 → 100644

1.08 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifySearch@3x.png 0 → 100644

1.93 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifySearchBlack@2x.png 0 → 100644

1.25 KB

CNLiveVideoClassifyKit/Assets/CNSegmentControl.bundle/ClassifySearchBlack@3x.png 0 → 100644

2.51 KB

CNLiveVideoClassifyKit/Classes/Category/UIImage+AdBundleImage.h 0 → 100644
  1 +//
  2 +// UIImage+AdBundleImage.h
  3 +// CNLiveVideoClassifyKit
  4 +//
  5 +// Created by CNLive on 2021/9/7.
  6 +//
  7 +
  8 +#import <UIKit/UIKit.h>
  9 +
  10 +NS_ASSUME_NONNULL_BEGIN
  11 +
  12 +@interface UIImage (AdBundleImage)
  13 +
  14 ++(UIImage *)loadBundleImage:(NSString *)imageName;
  15 +@end
  16 +
  17 +NS_ASSUME_NONNULL_END
CNLiveVideoClassifyKit/Classes/Category/UIImage+AdBundleImage.m 0 → 100644
  1 +//
  2 +// UIImage+AdBundleImage.m
  3 +// CNLiveVideoClassifyKit
  4 +//
  5 +// Created by CNLive on 2021/9/7.
  6 +//
  7 +
  8 +#import "UIImage+AdBundleImage.h"
  9 +#import "CNCategoryBaseViewController.h"
  10 +
  11 +@implementation UIImage (AdBundleImage)
  12 ++(UIImage *)loadBundleImage:(NSString *)imageName{
  13 +
  14 + // 获取当前的bundle,self只是在当前pod库中的一个类,也可以随意写一个其他的类
  15 + NSBundle *currentBundle = [NSBundle bundleForClass:[CNCategoryBaseViewController class]];
  16 + // 获取屏幕pt和px之间的比例
  17 + NSInteger scale = [UIScreen mainScreen].scale;
  18 + NSString *imagefailName = [NSString stringWithFormat:@"%@@%zdx.png",imageName,scale];
  19 + // 获取图片的路径,其中BMCH5WebView是组件名
  20 + NSString *imagePath = [currentBundle pathForResource:imagefailName ofType:nil inDirectory:[NSString stringWithFormat:@"%@.bundle",@"CNSegmentControl"]];
  21 + // 获取图片
  22 + return [UIImage imageWithContentsOfFile:imagePath];
  23 +}
  24 +@end
CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.m
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 { 14 {
15 NSString *_thirdUrl; 15 NSString *_thirdUrl;
16 NSDictionary *_paramDic; 16 NSDictionary *_paramDic;
  17 + CNLiveSubWebViewController *subVC;
17 18
18 } 19 }
19 @end 20 @end
@@ -38,6 +39,16 @@ @@ -38,6 +39,16 @@
38 self.view.backgroundColor = [UIColor whiteColor]; 39 self.view.backgroundColor = [UIColor whiteColor];
39 self.navigationHidden = YES; 40 self.navigationHidden = YES;
40 } 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 +}
41 52
42 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context 53 -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
43 { 54 {
@@ -55,7 +66,7 @@ @@ -55,7 +66,7 @@
55 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」 66 实现 <JXCategoryListContentViewDelegate> 协议方法,返回该视图控制器所拥有的「视图」
56 */ 67 */
57 - (UIView *)listView { 68 - (UIView *)listView {
58 - CNLiveSubWebViewController *subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_thirdUrl 69 + subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_thirdUrl
59 ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden]; 70 ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
60 for (UIView*subView in subVC.view.subviews) { 71 for (UIView*subView in subVC.view.subviews) {
61 if ([subView isKindOfClass:[WKWebView class]]) { 72 if ([subView isKindOfClass:[WKWebView class]]) {
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
@@ -273,6 +273,8 @@ static CGFloat moveHeight = 50; @@ -273,6 +273,8 @@ static CGFloat moveHeight = 50;
273 { 273 {
274 for (UIView *view in self.listContainerView.scrollView.subviews) { 274 for (UIView *view in self.listContainerView.scrollView.subviews) {
275 if ([view.viewController isKindOfClass:[CNLiveSubSegmentController class]]) { 275 if ([view.viewController isKindOfClass:[CNLiveSubSegmentController class]]) {
  276 + CNLiveSubSegmentController *subVc = view.viewController;
  277 + [subVc layoutRightSubViewWithShow:!enabled];
276 for (UIView *subView in view.subviews) { 278 for (UIView *subView in view.subviews) {
277 if ([subView isKindOfClass:[JXCategoryListContainerView class]]) { 279 if ([subView isKindOfClass:[JXCategoryListContainerView class]]) {
278 JXCategoryListContainerView *titleView = (JXCategoryListContainerView *)subView; 280 JXCategoryListContainerView *titleView = (JXCategoryListContainerView *)subView;
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.h
@@ -18,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN @@ -18,7 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
18 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *); 18 @property (nonatomic, copy) void (^scrollViewDidScrollBlock)(UIScrollView *);
19 @property (nonatomic, copy) void (^willBeginDragging)(CGFloat ); 19 @property (nonatomic, copy) void (^willBeginDragging)(CGFloat );
20 20
21 -//- (void)stopScrolling; 21 +// 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制
  22 +- (void)layoutRightSubViewWithShow:(BOOL)show;
22 23
23 @end 24 @end
24 25
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
@@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
11 11
12 @interface CNLiveSubSegmentController () 12 @interface CNLiveSubSegmentController ()
13 @property (nonatomic, strong)JXCategoryTitleView *myCategoryView; 13 @property (nonatomic, strong)JXCategoryTitleView *myCategoryView;
  14 +@property (nonatomic, strong) QMUIButton *searchBtn;
  15 +
14 @property (nonatomic, strong)NSArray<CNCategoryGetChannelModel*> *pageListArr; 16 @property (nonatomic, strong)NSArray<CNCategoryGetChannelModel*> *pageListArr;
15 @property (nonatomic, strong)UIColor *textColor; 17 @property (nonatomic, strong)UIColor *textColor;
16 @property (nonatomic, strong)UIColor *backgroundColor; 18 @property (nonatomic, strong)UIColor *backgroundColor;
@@ -47,6 +49,8 @@ @@ -47,6 +49,8 @@
47 49
48 - (void)viewDidLoad { 50 - (void)viewDidLoad {
49 [super viewDidLoad]; 51 [super viewDidLoad];
  52 + // 添加二级频道右侧的搜索按钮
  53 + [self.view addSubview:self.searchBtn];
50 self.view.backgroundColor = [UIColor clearColor]; 54 self.view.backgroundColor = [UIColor clearColor];
51 self.myCategoryView.titles = self.titles; 55 self.myCategoryView.titles = self.titles;
52 if (CNLiveStringIsEmpty(self.backImage)) { 56 if (CNLiveStringIsEmpty(self.backImage)) {
@@ -69,9 +73,13 @@ @@ -69,9 +73,13 @@
69 -(void)viewDidLayoutSubviews 73 -(void)viewDidLayoutSubviews
70 { 74 {
71 [super viewDidLayoutSubviews]; 75 [super viewDidLayoutSubviews];
72 -  
73 - self.categoryView.frame = CGRectMake(0, 0, self.view.bounds.size.width, [self preferredCategoryViewHeight]); 76 + self.searchBtn.frame = CGRectMake(0, 0, 66, 30);
  77 + self.searchBtn.right = KScreenWidth-12;
  78 + self.searchBtn.centerY = self.myCategoryView.height/2;
  79 + self.myCategoryView.top = 0;
  80 + self.myCategoryView.width = self.searchBtn.left;
74 self.listContainerView.frame = CGRectMake(0, [self preferredCategoryViewHeight]+10, self.view.bounds.size.width, self.view.bounds.size.height - [self preferredCategoryViewHeight]); 81 self.listContainerView.frame = CGRectMake(0, [self preferredCategoryViewHeight]+10, self.view.bounds.size.width, self.view.bounds.size.height - [self preferredCategoryViewHeight]);
  82 +
75 } 83 }
76 #pragma mark - Method 84 #pragma mark - Method
77 -(void)handleDateWithChannelsArray{ 85 -(void)handleDateWithChannelsArray{
@@ -81,6 +89,47 @@ @@ -81,6 +89,47 @@
81 [self.titles addObject:model.name]; 89 [self.titles addObject:model.name];
82 } 90 }
83 } 91 }
  92 +// 一级频道显示隐藏时二级频道右侧的搜索按钮变宽变窄控制
  93 +- (void)layoutRightSubViewWithShow:(BOOL)show {
  94 +
  95 + if (show) {
  96 + // 正常
  97 + [UIView animateWithDuration:0.3 animations:^{
  98 +
  99 + self.searchBtn.width = 66;
  100 + self.searchBtn.right = KScreenWidth-12;
  101 + [self.searchBtn setTitle:@"搜索" forState:UIControlStateNormal];
  102 +
  103 +// if ([self.channelModel.id isEqualToString:@"219"]) {
  104 +// self.moreBtn.right = KScreenWidth-12-66-15;
  105 +// self.progressView.right = KScreenWidth-93-18-15;
  106 +// } else if ([self.channelModel.id isEqualToString:@"11"]) {
  107 +// self.historyBtn.right = KScreenWidth-93;
  108 +// }
  109 +
  110 + self.myCategoryView.width = self.searchBtn.left;
  111 + }];
  112 + } else {
  113 + // 变窄
  114 + [UIView animateWithDuration:0.3 animations:^{
  115 +
  116 +
  117 +
  118 + self.searchBtn.width = 30;
  119 + self.searchBtn.right = KScreenWidth-12;
  120 + [self.searchBtn setTitle:nil forState:UIControlStateNormal];
  121 +
  122 +// if ([self.channelModel.id isEqualToString:@"219"]) {
  123 +// self.moreBtn.right = KScreenWidth-12-66-15+30;
  124 +// self.progressView.right = KScreenWidth-93-18-15+30;
  125 +// } else if ([self.channelModel.id isEqualToString:@"11"]) {
  126 +// self.historyBtn.right = KScreenWidth-93+30;
  127 +// }
  128 + self.myCategoryView.width = self.searchBtn.left;
  129 + }];
  130 + }
  131 +}
  132 +
84 #pragma mark - Public 133 #pragma mark - Public
85 -(JXCategoryTitleView *)preferredCategoryView{ 134 -(JXCategoryTitleView *)preferredCategoryView{
86 return [[JXCategoryTitleView alloc] init]; 135 return [[JXCategoryTitleView alloc] init];
@@ -119,6 +168,30 @@ @@ -119,6 +168,30 @@
119 return (JXCategoryTitleView *)self.categoryView; 168 return (JXCategoryTitleView *)self.categoryView;
120 } 169 }
121 170
  171 +- (QMUIButton *)searchBtn {
  172 + if (!_searchBtn) {
  173 + _searchBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  174 + [_searchBtn setTitle:@"搜索" forState:UIControlStateNormal];
  175 + _searchBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
  176 + if (self.isBlack) {
  177 + _searchBtn.backgroundColor = RGBA(245, 245, 245, 0.3);
  178 + [_searchBtn setTitleColor:KGray153Color forState:UIControlStateNormal];
  179 + [_searchBtn setImage:[UIImage loadBundleImage:@"ClassifySearchBlack"] forState:UIControlStateNormal];
  180 + }else
  181 + {
  182 + _searchBtn.backgroundColor = RGBA(249, 249, 249, 0.14);
  183 + [_searchBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
  184 + [_searchBtn setImage:[UIImage loadBundleImage:@"ClassifySearch"] forState:UIControlStateNormal];
  185 + }
  186 + _searchBtn.imagePosition = QMUIButtonImagePositionLeft;
  187 + _searchBtn.spacingBetweenImageAndTitle = 5;
  188 + _searchBtn.layer.cornerRadius = 15;
  189 + _searchBtn.layer.masksToBounds = YES;
  190 + [_searchBtn addTarget:self action:@selector(searchAction:) forControlEvents:UIControlEventTouchUpInside];
  191 + }
  192 + return _searchBtn;
  193 +}
  194 +
122 /* 195 /*
123 #pragma mark - Navigation 196 #pragma mark - Navigation
124 197
CNLiveVideoClassifyKit/Classes/Header/CNLivevideoClassifyPCH.h
@@ -19,6 +19,8 @@ @@ -19,6 +19,8 @@
19 #import <CNLiveCommonCategory/UIColor+CNLiveExtension.h> 19 #import <CNLiveCommonCategory/UIColor+CNLiveExtension.h>
20 #import <MJExtension/MJExtension.h> 20 #import <MJExtension/MJExtension.h>
21 #import "CNLiveCommonDefines.h" 21 #import "CNLiveCommonDefines.h"
  22 +#import <QMUIKit/QMUIKit.h>
  23 +#import "UIImage+AdBundleImage.h"
22 24
23 25
24 #endif /* CNLivevideoClassifyPCH_h */ 26 #endif /* CNLivevideoClassifyPCH_h */