Commit 20967c59ffcb80d00cf2606d76387bf7f19a3a31

Authored by yanglingyu
1 parent 3d9e36a9

no message

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

747 Bytes

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

1.35 KB

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

647 Bytes

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

1.18 KB

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

1.72 KB

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

2.98 KB

CNLiveVideoClassifyKit/Classes/Category/UIImage+AdBundleImage.m
... ... @@ -7,18 +7,12 @@
7 7  
8 8 #import "UIImage+AdBundleImage.h"
9 9 #import "CNCategoryBaseViewController.h"
  10 +#import <CNLiveCategory/CNLiveCategory.h>
10 11  
11 12 @implementation UIImage (AdBundleImage)
12 13 +(UIImage *)loadBundleImage:(NSString *)imageName{
13 14  
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];
  15 +
  16 + return [UIImage getImageWithImageName:imageName bundleName:@"CNSegmentControl" targetClass:[CNCategoryBaseViewController class]];
23 17 }
24 18 @end
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNCategoryBaseViewController.m
... ... @@ -17,7 +17,6 @@
17 17  
18 18 - (void)viewDidLoad {
19 19 [super viewDidLoad];
20   - [self handleDateWithChannelsArray];
21 20 [self.view addSubview: self.categoryView];
22 21 [self.view addSubview:self.listContainerView];
23 22 self.view.backgroundColor = [UIColor whiteColor];
... ... @@ -42,9 +41,6 @@
42 41 }
43 42  
44 43 #pragma mark - Public
45   --(void)handleDateWithChannelsArray{
46   -
47   -}
48 44 -(JXCategoryBaseView *)preferredCategoryView{
49 45 return [[JXCategoryBaseView alloc] init];
50 46 }
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNListViewController.m
... ... @@ -41,12 +41,12 @@
41 41 }
42 42 -(void)dealloc
43 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   - }
  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 50  
51 51 }
52 52  
... ... @@ -68,12 +68,12 @@
68 68 - (UIView *)listView {
69 69 subVC = [CNLiveCWebViewModule showWebVCWithLunchForWebURL:_thirdUrl
70 70 ParamDict:_paramDic ShowType:CNLiveWebViewLunchShowTypeHidden];
71   - for (UIView*subView in subVC.view.subviews) {
72   - if ([subView isKindOfClass:[WKWebView class]]) {
73   - WKWebView *webView = (WKWebView *)subView;
74   - [webView.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld context:NULL];
75   - }
76   - }
  71 +// for (UIView*subView in subVC.view.subviews) {
  72 +// if ([subView isKindOfClass:[WKWebView class]]) {
  73 +// WKWebView *webView = (WKWebView *)subView;
  74 +// [webView.scrollView addObserver:self forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionOld context:NULL];
  75 +// }
  76 +// }
77 77  
78 78 return subVC.view;
79 79 }
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveClassifySegmentController.m
... ... @@ -13,7 +13,10 @@
13 13 #import "CNLiveSubSegmentController.h"
14 14 #import <CNLiveCWebViewModule/CNLiveWebViewJumpBridge.h>
15 15  
16   -@interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate>
  16 +static const CGFloat animationTime = 0.3;
  17 +static const CGFloat animationHeight = 15;
  18 +
  19 +@interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate,CNCustomChannelListViewDelegate>
17 20  
18 21 @property (nonatomic, strong)JXCategoryTitleImageView *myCategoryView; //选择器
19 22 @property (nonatomic, strong) UIButton *customChannelsBtn;
... ... @@ -37,6 +40,10 @@
37 40 @property (nonatomic, strong) NSMutableArray *textColors; //未选中字体颜色
38 41 @property (nonatomic, strong) NSMutableArray *textColorSeleteds; //选中字体颜色
39 42  
  43 +@property (nonatomic, assign) BOOL hasChanged;
  44 +@property (nonatomic, assign) BOOL isEditing;
  45 +@property (nonatomic, assign) BOOL oldStatusBar;
  46 +
40 47 @end
41 48  
42 49 @implementation CNLiveClassifySegmentController
... ... @@ -44,27 +51,20 @@ static CGFloat moveHeight = 50;
44 51 - (void)viewDidLoad {
45 52 [super viewDidLoad];
46 53 self.topBgImgHeight = kStatusHeight+100;
  54 + self.currentIndex = 0;
47 55 [self.view addSubview:self.topBgImg];
48 56 [self.view sendSubviewToBack:self.topBgImg];
  57 + [self dataDivideIntoNormalAndOtherWithFirst:YES];
  58 + [self handleDateWithChannelsArray];
49 59 if ([CNUserShareManager isLogin]) {
50   - [self.myCategoryView addSubview:self.customChannelsBtn];
  60 + [self.view addSubview:self.customChannelsBtn];
51 61 }else
52 62 {
53   - [self.myCategoryView addSubview:self.loginBtn];
  63 + [self.view addSubview:self.loginBtn];
54 64 }
55   -
56   - for (int i = 0;i<self.imageNames.count;i++) {
57   - NSURL *url = [NSURL URLWithString:self.imageNames[i]];
58   - [self.imageNames replaceObjectAtIndex:i withObject:url];
59   - }
60   - //分类控制器基础配置
61   - self.myCategoryView.titles = self.titles;
62 65 self.myCategoryView.delegate = self;
  66 +
63 67 self.myCategoryView.translatesAutoresizingMaskIntoConstraints = NO;
64   - self.myCategoryView.imageURLs = self.imageNames;
65   - self.myCategoryView.loadImageCallback = ^(UIImageView *imageView, NSURL *imageURL) {
66   - [imageView sd_setImageWithURL:imageURL];
67   - };
68 68 self.myCategoryView.titleColorGradientEnabled = YES;
69 69 self.myCategoryView.contentEdgeInsetLeft = 10;
70 70 self.myCategoryView.titleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:15];
... ... @@ -76,10 +76,8 @@ static CGFloat moveHeight = 50;
76 76 self.myCategoryView.cellWidthZoomEnabled = YES;
77 77 self.myCategoryView.cellWidthZoomScale = 1.3;
78 78 self.myCategoryView.imageSize = CGSizeMake(56, 18);
79   - [self updateSelectColors:0];
80   - [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:0 unselectIndex:0];
81   -
82 79 self.listContainerView.translatesAutoresizingMaskIntoConstraints = NO;
  80 + [self uploadSubViews];
83 81 // Do any additional setup after loading the view.
84 82 }
85 83  
... ... @@ -89,12 +87,12 @@ static CGFloat moveHeight = 50;
89 87 self.listContainerView.frame = CGRectMake(0,self.myCategoryView.bottom, kScreenWidth, self.view.height -kStatusHeight);
90 88 if ([CNUserShareManager isLogin]) {
91 89 self.myCategoryView.width = kScreenWidth - 45;
92   - self.customChannelsBtn.centerY = self.myCategoryView.height/2;
  90 + self.customChannelsBtn.centerY = self.myCategoryView.centerY;
93 91 self.customChannelsBtn.right = kScreenWidth - 18;
94 92 }else
95 93 {
96 94 self.myCategoryView.width = kScreenWidth - 70;
97   - self.loginBtn.centerY = self.myCategoryView.height/2;
  95 + self.loginBtn.centerY = self.myCategoryView.centerY;
98 96 self.loginBtn.right = kScreenWidth - 11;
99 97 }
100 98  
... ... @@ -109,7 +107,7 @@ static CGFloat moveHeight = 50;
109 107 -(void)viewDidDisappear:(BOOL)animated
110 108 {
111 109 [super viewDidDisappear: animated];
112   -
  110 + [self quitCustomChannels];
113 111 }
114 112  
115 113  
... ... @@ -125,11 +123,45 @@ static CGFloat moveHeight = 50;
125 123 }
126 124  
127 125 }
128   -
  126 +- (void)uploadSubViews
  127 +{
  128 + if (self.currentIndex>=self.titles.count) {
  129 + self.currentIndex = 0;
  130 + }
  131 + for (int i = 0;i<self.imageNames.count;i++) {
  132 + NSURL *url = [NSURL URLWithString:self.imageNames[i]];
  133 + [self.imageNames replaceObjectAtIndex:i withObject:url];
  134 + }
  135 + //分类控制器基础配置
  136 + self.myCategoryView.titles = self.titles;
  137 + self.myCategoryView.delegate = self;
  138 + self.myCategoryView.imageURLs = self.imageNames;
  139 + self.myCategoryView.defaultSelectedIndex = self.currentIndex;
  140 + self.myCategoryView.loadImageCallback = ^(UIImageView *imageView, NSURL *imageURL) {
  141 + [imageView sd_setImageWithURL:imageURL];
  142 + };
  143 + [self updateSelectColors:self.currentIndex];
  144 + [self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:self.currentIndex unselectIndex:self.currentIndex];
  145 +}
129 146 #pragma mark - Action
130 147 // 点击定制频道按钮进入定制
131 148 - (void)customAction:(UIButton *)sender {
132   -
  149 + [[NSNotificationCenter defaultCenter] postNotificationName:WjjH5StopVideoPlayerNotification object:nil];
  150 + [[NSNotificationCenter defaultCenter] postNotificationName:kDSHappinessPageControlScrollEnableNotification object:@(YES)];
  151 + self.hasChanged = NO;
  152 + self.isEditing = YES;
  153 + if (self.currentAtatusColor.intValue == 0) {
  154 + self.oldStatusBar = YES;
  155 + self.currentAtatusColor = @"1";
  156 + [self setNeedsStatusBarAppearanceUpdate];
  157 + } else {
  158 + self.oldStatusBar = NO;
  159 + }
  160 + [self.view addSubview:self.customChannelsV];
  161 + [UIView animateWithDuration:animationTime animations:^{
  162 + self.customChannelsV.alpha = 1.0;
  163 + self.customChannelsV.y = 0;
  164 + }];
133 165 }
134 166 // 登录
135 167 - (void)loginAction:(UIButton *)sender {
... ... @@ -172,13 +204,134 @@ static CGFloat moveHeight = 50;
172 204 [self.myCategoryView reloadCellAtIndex:i];
173 205 }
174 206 }
  207 +- (void)dataDivideIntoNormalAndOtherWithFirst:(BOOL)first {
  208 +
  209 + NSArray *channelsArray = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddGetCategoryChannels];
  210 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  211 + NSString *otherKey = [NSString stringWithFormat:@"%@_%@",OtherChannelArray,CNUserShareModel.uid];
  212 + NSMutableArray *normalArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
  213 + NSMutableArray *otherArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:otherKey]];
  214 +
  215 + // 请求到过数据
  216 + if ([NSArray isArray:channelsArray]) {
  217 +
  218 + NSString *newChannelVer = [[NSUserDefaults standardUserDefaults] objectForKey:CNWjjNewCategoryChannelVerKey];
  219 + NSString *oldChannelVer = [[NSUserDefaults standardUserDefaults] objectForKey:CNWjjOldCategoryChannelVerKey];
  220 + if (CNLiveStringIsEmpty(newChannelVer) || CNLiveStringIsEmpty(oldChannelVer) || [newChannelVer isEqualToString:oldChannelVer]) {// 没有新版本
  221 +
  222 + NSMutableArray *tempAllArray = [[NSMutableArray alloc] initWithArray:channelsArray]; //临时总频道
  223 + NSMutableArray *tempOtherArray = [NSMutableArray array];//临时其他频道
  224 + NSMutableArray *tempNormalArray = [NSMutableArray array];//临时我的频道
  225 + if ([NSArray isArray:otherArray]) {//"其他频道"有数据
  226 + // 比较数据并存储
  227 + for (NSString *str in otherArray) {//遍历其他频道
  228 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  229 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  230 + NSInteger index = [model containsWithChannelArray:tempAllArray];
  231 + if (index==-1) {
  232 + continue;
  233 + }
  234 + [tempOtherArray addObject:[tempAllArray safetyObjectAtIndex:index]];
  235 + if (index<tempAllArray.count) {
  236 + [tempAllArray removeObjectAtIndex:index];
  237 + }
  238 + }
  239 + [otherArray removeAllObjects];
  240 + otherArray = tempOtherArray; //新"其他频道"
  241 + }
  242 + for (NSString *str in normalArray) { //对"我的频道"按本地顺序排序
  243 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  244 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  245 + NSInteger index = [model containsWithChannelArray:tempAllArray];
  246 + if (index==-1) {
  247 + continue;
  248 + }
  249 + [tempNormalArray addObject:[tempAllArray safetyObjectAtIndex:index]];
  250 + if (index<tempAllArray.count) {
  251 + [tempAllArray removeObjectAtIndex:index];
  252 + }
  253 + }
  254 + [tempNormalArray addObjectsFromArray:tempAllArray];
  255 + [normalArray removeAllObjects];
  256 + normalArray = tempNormalArray;
  257 +
  258 + } else {
  259 +
  260 + // 有新版本
  261 + normalArray = channelsArray.mutableCopy;
  262 + [otherArray removeAllObjects];
  263 +
  264 + }
  265 + [[NSUserDefaults standardUserDefaults] setObject:newChannelVer forKey:CNWjjOldCategoryChannelVerKey];
  266 +
  267 + } else { // 从未请求到过数据
  268 +
  269 +// if (![CNTools manager].channelsRequested && first) {
  270 +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil];
  271 +// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil];
  272 +// [QMUITips showLoadingInView:self.view];
  273 +// self.isLoading = YES;
  274 +// return;
  275 +// }
  276 +
  277 + // 默认数据
  278 + NSMutableArray *defaultArray = [NSMutableArray array];
  279 + NSString *jsonName = [CNLiveEnvironmentManager manager].isTestEnvironment?@"wjjCategoryH5Test":@"wjjCategoryH5";
  280 + NSString *path = [[NSBundle mainBundle] pathForResource:jsonName ofType:@"json"];
  281 + NSData *data = [[NSData alloc] initWithContentsOfFile:path];
  282 + NSArray *dataArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
  283 + for (NSDictionary *dic in dataArray) {
  284 + [defaultArray addObject:CNLiveNSDictionaryDicToJson(dic)];
  285 + }
  286 + NSMutableArray *tempAllArray = [[NSMutableArray alloc] initWithArray:defaultArray];
  287 + NSMutableArray *tempOtherArray = [NSMutableArray array];
  288 + NSMutableArray *tempNormalArray = [NSMutableArray array];//临时我的频道
  289 + if ([NSArray isArray:otherArray]) {//其他频道有数据
  290 + // 比较数据并存储
  291 + for (NSString *str in otherArray) {
  292 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  293 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  294 + NSInteger index = [model containsWithChannelArray:tempAllArray];
  295 + if (index==-1) {
  296 + continue;
  297 + }
  298 + [tempOtherArray addObject:[tempAllArray safetyObjectAtIndex:index]];
  299 + if (index<tempAllArray.count) {
  300 + [tempAllArray removeObjectAtIndex:index];
  301 + }
  302 + }
  303 + [otherArray removeAllObjects];
  304 + otherArray = tempOtherArray;
  305 +
  306 + }
  307 + for (NSString *str in normalArray) { //对"我的频道"按本地顺序排序
  308 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
  309 + CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
  310 + NSInteger index = [model containsWithChannelArray:tempAllArray];
  311 + if (index==-1) {
  312 + continue;
  313 + }
  314 + [tempNormalArray addObject:[tempAllArray safetyObjectAtIndex:index]];
  315 + if (index<tempAllArray.count) {
  316 + [tempAllArray removeObjectAtIndex:index];
  317 + }
  318 + }
  319 + [tempNormalArray addObjectsFromArray:tempAllArray];
  320 + [normalArray removeAllObjects];
  321 + normalArray = tempNormalArray;
  322 + [[NSUserDefaults standardUserDefaults] setObject:@"default" forKey:CNWjjOldCategoryChannelVerKey];
  323 + }
  324 +
  325 + [[NSUserDefaults standardUserDefaults] setObject:normalArray forKey:normalKey];
  326 + [[NSUserDefaults standardUserDefaults] setObject:otherArray forKey:otherKey];
  327 + [[NSUserDefaults standardUserDefaults] synchronize];
  328 +}
175 329  
176 330 //解析数据
177 331 -(void)handleDateWithChannelsArray
178 332 {
179   - NSString *normalStr = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddGetCategoryChannels];
180   - NSDictionary *dic =CNLiveStringJsonToDictionary(normalStr);
181   - NSArray *normalArray = dic[@"data"];
  333 + NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
  334 + NSArray *normalArray = [[NSUserDefaults standardUserDefaults] objectForKey:normalKey];
182 335 [self.dataArray removeAllObjects];
183 336 [self.titles removeAllObjects];
184 337 [self.imageNames removeAllObjects];
... ... @@ -187,7 +340,8 @@ static CGFloat moveHeight = 50;
187 340 [self.textColors removeAllObjects];
188 341 [self.textColorSeleteds removeAllObjects];
189 342 [self.statusBarColors removeAllObjects];
190   - for (NSDictionary *dic in normalArray) {
  343 + for (NSString *str in normalArray) {
  344 + NSDictionary *dic = CNLiveStringJsonToDictionary(str);
191 345 CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
192 346 [self.dataArray addObject:model];
193 347 [self.titles addObject:model.showName];
... ... @@ -241,10 +395,10 @@ static CGFloat moveHeight = 50;
241 395 [self scrollViewDown];
242 396 }
243 397 if ([CNUserShareManager isLogin]) {
244   - self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY;
  398 + self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY + kStatusHeight;
245 399 }else
246 400 {
247   - self.loginBtn.centerY = self.myCategoryView.collectionView.centerY;
  401 + self.loginBtn.centerY = self.myCategoryView.collectionView.centerY+kStatusHeight;
248 402 }
249 403 }];
250 404 }
... ... @@ -273,7 +427,7 @@ static CGFloat moveHeight = 50;
273 427 {
274 428 for (UIView *view in self.listContainerView.scrollView.subviews) {
275 429 if ([view.viewController isKindOfClass:[CNLiveSubSegmentController class]]) {
276   - CNLiveSubSegmentController *subVc = view.viewController;
  430 + CNLiveSubSegmentController *subVc = (CNLiveSubSegmentController *)view.viewController;
277 431 [subVc layoutRightSubViewWithShow:!enabled];
278 432 for (UIView *subView in view.subviews) {
279 433 if ([subView isKindOfClass:[JXCategoryListContainerView class]]) {
... ... @@ -286,6 +440,51 @@ static CGFloat moveHeight = 50;
286 440 }
287 441 }
288 442 }
  443 +#pragma mark - CNCustomChannelListViewDelegate !!!!!!!!!!!!!!!!!!!!!!
  444 +- (void)changeChannelsList
  445 +{
  446 + // "完成"分类频道顺序重排
  447 + [self handleDateWithChannelsArray];
  448 + [self uploadSubViews];
  449 + [self.myCategoryView reloadData];
  450 + self.hasChanged = YES;
  451 +}
  452 +
  453 +- (void)didSelectedCommonChannelWithIndex:(NSInteger)index
  454 +{
  455 + [self quitCustomChannels];
  456 + [self.myCategoryView selectItemAtIndex:index];
  457 +}
  458 +
  459 +- (void)pushToControllerWithIndex:(NSInteger)index
  460 +{
  461 + // 跳到其他频道的对应页面
  462 +// [self goToOtherChannelViewControllerWithIndex:index];
  463 +}
  464 +
  465 +- (void)closeCustomChannelsView {
  466 + // 关闭定制频道页
  467 + [self quitCustomChannels];
  468 +}
  469 +// 退出定制频道编辑页面
  470 +- (void)quitCustomChannels {
  471 +
  472 + self.isEditing = NO;
  473 + if (self.oldStatusBar && !self.hasChanged) {
  474 + self.oldStatusBar = NO;
  475 + self.currentAtatusColor = @"0";
  476 + [self setNeedsStatusBarAppearanceUpdate];
  477 + }
  478 + self.hasChanged = NO;
  479 + [UIView animateWithDuration:animationTime animations:^{
  480 + self.customChannelsV.alpha = 0.0;
  481 + self.customChannelsV.y = animationHeight;
  482 + } completion:^(BOOL finished) {
  483 + [self.customChannelsV removeFromSuperview];
  484 + self.customChannelsV = nil;
  485 + }];
  486 +}
  487 +
289 488 #pragma mark - JXCategoryViewDelegate
290 489 // 正在滚动中的回调,这里调整背景图片的 alpha 透明度
291 490 - (void)categoryView:(JXCategoryBaseView *)categoryView scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio {
... ... @@ -314,14 +513,14 @@ static CGFloat moveHeight = 50;
314 513 if (model.pageStyleList.count>0) {
315 514 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight);
316 515 CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model];
317   - subVC.isBlack = isBlack;
318   - weakself
319   - subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
320   - [weakSelf listScrollViewDidScroll:scrollView];
321   - };
322   - subVC.willBeginDragging = ^(CGFloat lastOffsetY) {
323   - weakSelf.lastOffsetY = lastOffsetY;
324   - };
  516 +// subVC.isBlack = isBlack;
  517 +// weakself
  518 +// subVC.scrollViewDidScrollBlock = ^(UIScrollView * _Nonnull scrollView) {
  519 +// [weakSelf listScrollViewDidScroll:scrollView];
  520 +// };
  521 +// subVC.willBeginDragging = ^(CGFloat lastOffsetY) {
  522 +// weakSelf.lastOffsetY = lastOffsetY;
  523 +// };
325 524 return subVC;
326 525 }
327 526 self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50);
... ... @@ -360,14 +559,22 @@ static CGFloat moveHeight = 50;
360 559 - (UIButton *)customChannelsBtn {
361 560 if (!_customChannelsBtn) {
362 561 _customChannelsBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 19, 19)];
363   - [_customChannelsBtn setImage:[UIImage imageNamed:@"ik_subtitle_more-black"] forState:UIControlStateNormal];
364   - [self.customChannelsBtn setImage:[UIImage imageNamed:@"ik_subtitle_more-white"] forState:UIControlStateSelected];
  562 + [_customChannelsBtn setImage:[UIImage loadBundleImage:@"ik_subtitle_more_black"] forState:UIControlStateNormal];
  563 + [_customChannelsBtn setImage:[UIImage loadBundleImage:@"ik_subtitle_more_white"] forState:UIControlStateSelected];
365 564 [_customChannelsBtn addTarget:self action:@selector(customAction:) forControlEvents:UIControlEventTouchUpInside];
366 565 _customChannelsBtn.touchAreaInsets = UIEdgeInsetsMake(20, 20, 20, 20);
367 566 }
368 567 return _customChannelsBtn;
369 568 }
370   -
  569 +- (CNCustomChannelListView *)customChannelsV {
  570 + if (!_customChannelsV) {
  571 + _customChannelsV = [[CNCustomChannelListView alloc] initWithFrame:CGRectMake(0, animationHeight, KScreenWidth, KScreenHeight)];
  572 + _customChannelsV.backgroundColor = kWhiteColor;
  573 + _customChannelsV.alpha = 0;
  574 + _customChannelsV.delegate = self;
  575 + }
  576 + return _customChannelsV;
  577 +}
371 578  
372 579 - (UIButton *)loginBtn {
373 580 if (!_loginBtn) {
... ...
CNLiveVideoClassifyKit/Classes/Controller/CNLiveSubSegmentController.m
... ... @@ -22,7 +22,10 @@
22 22 @end
23 23  
24 24 @implementation CNLiveSubSegmentController
25   -
  25 +-(void)dealloc
  26 +{
  27 +
  28 +}
26 29 -(instancetype)initWithModel:(CNCategoryGetChannelModel *)model
27 30 {
28 31 self = [super init];
... ... @@ -52,6 +55,7 @@
52 55 // 添加二级频道右侧的搜索按钮
53 56 [self.view addSubview:self.searchBtn];
54 57 self.view.backgroundColor = [UIColor clearColor];
  58 + [self handleDateWithChannelsArray];
55 59 self.myCategoryView.titles = self.titles;
56 60 if (CNLiveStringIsEmpty(self.backImage)) {
57 61 self.view.backgroundColor = self.backgroundColor;
... ... @@ -73,7 +77,6 @@
73 77 -(void)viewDidLayoutSubviews
74 78 {
75 79 [super viewDidLayoutSubviews];
76   - self.searchBtn.frame = CGRectMake(0, 0, 66, 30);
77 80 self.searchBtn.right = KScreenWidth-12;
78 81 self.searchBtn.centerY = self.myCategoryView.height/2;
79 82 self.myCategoryView.top = 0;
... ... @@ -94,7 +97,6 @@
94 97  
95 98 if (show) {
96 99 // 正常
97   - [UIView animateWithDuration:0.3 animations:^{
98 100  
99 101 self.searchBtn.width = 66;
100 102 self.searchBtn.right = KScreenWidth-12;
... ... @@ -108,12 +110,8 @@
108 110 // }
109 111  
110 112 self.myCategoryView.width = self.searchBtn.left;
111   - }];
112 113 } else {
113 114 // 变窄
114   - [UIView animateWithDuration:0.3 animations:^{
115   -
116   -
117 115  
118 116 self.searchBtn.width = 30;
119 117 self.searchBtn.right = KScreenWidth-12;
... ... @@ -126,7 +124,6 @@
126 124 // self.historyBtn.right = KScreenWidth-93+30;
127 125 // }
128 126 self.myCategoryView.width = self.searchBtn.left;
129   - }];
130 127 }
131 128 }
132 129  
... ... @@ -171,6 +168,7 @@
171 168 - (QMUIButton *)searchBtn {
172 169 if (!_searchBtn) {
173 170 _searchBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  171 + _searchBtn.frame = CGRectMake(0, 0, 66, 30);
174 172 [_searchBtn setTitle:@"搜索" forState:UIControlStateNormal];
175 173 _searchBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
176 174 if (self.isBlack) {
... ...
CNLiveVideoClassifyKit/Classes/Header/CNLiveCommonDefines.h
... ... @@ -52,9 +52,9 @@
52 52 //#endif
53 53 //
54 54 //// 分类停止播放目击者列表中的视频
55   -//#ifndef WjjH5StopVideoPlayerNotification
56   -//#define WjjH5StopVideoPlayerNotification @"WjjH5StopVideoPlayerNotification"
57   -//#endif
  55 +#ifndef WjjH5StopVideoPlayerNotification
  56 +#define WjjH5StopVideoPlayerNotification @"WjjH5StopVideoPlayerNotification"
  57 +#endif
58 58 //
59 59 //#define kCNLiveGeneralMargin 10*RATIO //通用间距
60 60 //#define kCNLiveNotGeneralMargin 10 //通用间距
... ... @@ -67,11 +67,24 @@
67 67 //
68 68 //static NSString *const CNLiveFirendCircleEmptyItemDesc = @"当前版本过低,暂不支持查看此动态,请升级网家家最新版本查看消息。";
69 69 //
70   -//#pragma mark - 电商中国首页
71   -////NSString * const kDSHappinessPageControlScrollEnableNotification = @"kDSHappinessPageControlScrollEnableNotification";
72   -//
73   -//
74   -//
  70 +
  71 +#ifndef CNWjjClassifyChannelsRequestHideLoadingNotifiName
  72 +#define CNWjjClassifyChannelsRequestHideLoadingNotifiName @"CNWjjClassifyChannelsRequestHideLoadingNotifiName"
  73 +#endif
  74 +//分类-频道-新版本
  75 +#ifndef CNWjjNewCategoryChannelVerKey
  76 +#define CNWjjNewCategoryChannelVerKey @"CNWjjNewCategoryChannelVerKey"
  77 +#endif
  78 +//分类-频道-旧版本
  79 +#ifndef CNWjjOldCategoryChannelVerKey
  80 +#define CNWjjOldCategoryChannelVerKey @"CNWjjOldCategoryChannelVerKey"
  81 +#endif
  82 +#pragma mark - 电商中国首页
  83 +#ifndef kDSHappinessPageControlScrollEnableNotification
  84 +#define kDSHappinessPageControlScrollEnableNotification @"kDSHappinessPageControlScrollEnableNotification"
  85 +#endif
  86 +
  87 +
75 88 //#define cn_WjjH5_Host(url) [NSString stringWithFormat:@"%@%@",[CNLiveEnvironmentManager manager].kWjjH5_Host,url]
76 89 //
77 90 //#define RGBACOLOR(r,g,b,a) \
... ...
CNLiveVideoClassifyKit/Classes/Header/CNLivevideoClassifyPCH.h
... ... @@ -21,6 +21,7 @@
21 21 #import "CNLiveCommonDefines.h"
22 22 #import <QMUIKit/QMUIKit.h>
23 23 #import "UIImage+AdBundleImage.h"
  24 +#import "CNLiveClassifySegmentController.h"
24 25  
25 26  
26 27 #endif /* CNLivevideoClassifyPCH_h */
... ...
CNLiveVideoClassifyKit/Classes/view/CNCustomChannelListCell.m
... ... @@ -25,7 +25,7 @@ static CGFloat const imageViewHeight = 25.0f;
25 25 if (self) {
26 26  
27 27 self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake((CellWidth-imageViewHeight)*0.5, 15, imageViewHeight, imageViewHeight)];
28   - self.imageView.image = [UIImage imageNamed:@"more_zwf"];
  28 + self.imageView.image = [UIImage loadBundleImage:@"more_zwf"];
29 29 [self addSubview:self.imageView];
30 30  
31 31 self.titleLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 15 + imageViewHeight + 22, CellWidth, 14*RATIO)];
... ... @@ -35,7 +35,7 @@ static CGFloat const imageViewHeight = 25.0f;
35 35 [self addSubview:self.titleLbl];
36 36  
37 37 self.addImageView = [[UIImageView alloc] initWithFrame:CGRectMake(CellWidth - 20, 6, 14, 14)];
38   - self.addImageView.image = [UIImage imageNamed:@"more_add"];
  38 + self.addImageView.image = [UIImage loadBundleImage:@"more_add"];
39 39 self.addImageView.hidden = YES;
40 40 [self addSubview:self.addImageView];
41 41  
... ... @@ -59,10 +59,10 @@ static CGFloat const imageViewHeight = 25.0f;
59 59 {
60 60 _isNeedAdd = isNeedAdd;
61 61 if (isNeedAdd) {
62   - self.addImageView.image = [UIImage imageNamed:@"more_add"];
  62 + self.addImageView.image = [UIImage loadBundleImage:@"more_add"];
63 63 }
64 64 else {
65   - self.addImageView.image = [UIImage imageNamed:@"more_reduce"];
  65 + self.addImageView.image = [UIImage loadBundleImage:@"more_reduce"];
66 66 }
67 67 }
68 68  
... ...
CNLiveVideoClassifyKit/Classes/view/CNCustomChannelListView.m
... ... @@ -419,7 +419,7 @@ static NSString * const headerIdentifier = @&quot;CustomChannelsHeader&quot;;
419 419 NSString *dataStr = [self.commonChannel safetyObjectAtIndex:indexPath.row];
420 420 NSDictionary *dic = CNLiveStringJsonToDictionary(dataStr);
421 421 CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
422   - [cell.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon?model.icon:@""] placeholderImage:[UIImage imageNamed:@"more_zwf"]];
  422 + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon?model.icon:@""] placeholderImage:[UIImage loadBundleImage:@"more_zwf"]];
423 423 cell.titleLbl.text = model.showName;
424 424 if (indexPath.row == 0) {
425 425 cell.isHideAdd = YES;
... ... @@ -437,7 +437,7 @@ static NSString * const headerIdentifier = @&quot;CustomChannelsHeader&quot;;
437 437 NSString *dataStr = [self.otherChannel safetyObjectAtIndex:indexPath.row];
438 438 NSDictionary *dic = CNLiveStringJsonToDictionary(dataStr);
439 439 CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
440   - [cell.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon?model.icon:@""] placeholderImage:[UIImage imageNamed:@"more_zwf"]];
  440 + [cell.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon?model.icon:@""] placeholderImage:[UIImage loadBundleImage:@"more_zwf"]];
441 441 cell.titleLbl.text = model.showName;
442 442 if (self.isEdit) {
443 443 cell.isHideAdd = NO;
... ... @@ -465,7 +465,7 @@ static NSString * const headerIdentifier = @&quot;CustomChannelsHeader&quot;;
465 465 - (UIButton *)closeBtn {
466 466 if (!_closeBtn) {
467 467 _closeBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 16, 16)];
468   - [_closeBtn setImage:[UIImage imageNamed:@"jj_close"] forState:UIControlStateNormal];
  468 + [_closeBtn setImage:[UIImage loadBundleImage:@"jj_close"] forState:UIControlStateNormal];
469 469 [_closeBtn addTarget:self action:@selector(closeAction:) forControlEvents:UIControlEventTouchUpInside];
470 470 _closeBtn.touchAreaInsets = UIEdgeInsetsMake(20, 20, 20, 20);
471 471 }
... ...
Example/CNLiveVideoClassifyKit/CNLIVEViewController.m
... ... @@ -9,7 +9,7 @@
9 9 #import "CNLIVEViewController.h"
10 10 #import <CNLiveBaseKit/CNLiveBaseKit.h>
11 11 #import "CNliveCollectionViewCell.h"
12   -#import <CNLiveVideoClassifyKit/CNLiveClassifySegmentController.h>
  12 +#import <CNLiveVideoClassifyKit/CNLivevideoClassifyPCH.h>
13 13 #import <CNLiveNetworking.h>
14 14 #import <NSString+CNLiveExtension.h>
15 15 #import <CNLiveEnvironment/CNLiveEnvironment.h>
... ... @@ -45,8 +45,12 @@
45 45 };
46 46 [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodGET URLString:CNCategoryGetChannelUrl Param:dic CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
47 47 if ([NSArray isArray:responseObject[@"data"]]) {
48   - NSString *jsonStr = CNLiveNSDictionaryDicToJson(responseObject);
49   - [[NSUserDefaults standardUserDefaults] setObject:jsonStr forKey:CNLiveNetAddGetCategoryChannels];
  48 + NSMutableArray *jsonArray = [[NSMutableArray alloc] init];
  49 + for (NSDictionary *dic in responseObject[@"data"]) {
  50 + NSString *jsonStr = CNLiveNSDictionaryDicToJson(dic);
  51 + [jsonArray addObject:jsonStr];
  52 + }
  53 + [[NSUserDefaults standardUserDefaults] setObject:jsonArray forKey:CNLiveNetAddGetCategoryChannels];
50 54 [[NSUserDefaults standardUserDefaults] synchronize];
51 55 }
52 56  
... ...