CNLiveClassifySegmentController.m
25.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
//
// CNLiveClassifySegmentController.m
// CNLiveBaseClass
//
// Created by CNLive on 2021/8/7.
//
#import "CNLiveClassifySegmentController.h"
#import <UIKit/UIKit.h>
#import "CNCustomChannelListView.h"
#import "CNCategoryGetChannelModel.h"
#import "CNLiveListManager.h"
#import "CNLiveSubSegmentController.h"
static const CGFloat animationTime = 0.3;
static const CGFloat animationHeight = 15;
@interface CNLiveClassifySegmentController ()<JXCategoryViewDelegate,CNCustomChannelListViewDelegate>
@property (nonatomic, strong)JXCategoryTitleImageView *myCategoryView; //选择器
@property (nonatomic, strong) UIButton *customChannelsBtn;
@property (nonatomic, strong) UIButton *loginBtn;
@property (nonatomic, strong) CNCustomChannelListView *customChannelsV;
//@property (nonatomic, strong) CNTouristsLoginTipsView *fuzzyView;//游客登录弹框
@property (nonatomic, strong) UIImageView *topBgImg; //头部图片
@property (nonatomic, assign) CGFloat topBgImgHeight;//头部图片高度
@property (nonatomic, assign) CGFloat lastOffsetY;
@property (nonatomic, assign) NSInteger currentIndex;//当前页
@property (nonatomic, strong) NSString * currentAtatusColor;
@property (nonatomic, strong) NSMutableArray *dataArray; //数据
@property (nonatomic, strong) NSMutableArray *bgImages; //背景图
@property (nonatomic, strong) NSMutableArray *bgColors; //背景色
@property (nonatomic, strong) NSMutableArray *imageNames; //选择器图片
@property (nonatomic, strong) NSMutableArray *imageTypes; //展示类型:图片/文字
@property (nonatomic, strong) NSMutableArray *statusBarColors; //状态栏颜色
@property (nonatomic, strong) NSMutableArray *textColors; //未选中字体颜色
@property (nonatomic, strong) NSMutableArray *textColorSeleteds; //选中字体颜色
@property (nonatomic, assign) BOOL hasChanged;
@property (nonatomic, assign) BOOL isEditing;
@property (nonatomic, assign) BOOL oldStatusBar;
@property (nonatomic, assign) BOOL isLoading;
@end
@implementation CNLiveClassifySegmentController
static CGFloat moveHeight = 50;
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequest:) name:CNWjjClassifyChannelsRequestStateNotifiName object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classifyChannelsRequestedHideLoading:) name:CNWjjClassifyChannelsRequestHideLoadingNotifiName object:nil];
self.topBgImgHeight = kStatusHeight+100;
self.currentIndex = 0;
[self.view addSubview:self.topBgImg];
[self.view sendSubviewToBack:self.topBgImg];
[self dataDivideIntoNormalAndOtherWithFirst:YES];
[self handleDateWithChannelsArray];
if ([CNUserShareManager isLogin]) {
[self.view addSubview:self.customChannelsBtn];
}else
{
[self.view addSubview:self.loginBtn];
}
self.myCategoryView.delegate = self;
self.myCategoryView.translatesAutoresizingMaskIntoConstraints = NO;
self.myCategoryView.titleColorGradientEnabled = YES;
self.myCategoryView.contentEdgeInsetLeft = 10;
self.myCategoryView.titleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:15];
self.myCategoryView.imageZoomEnabled = YES;
self.myCategoryView.imageZoomScale = 1.3;
self.myCategoryView.selectedAnimationEnabled = YES;
self.myCategoryView.titleLabelZoomEnabled = YES;
self.myCategoryView.titleLabelZoomScale = 1.4;
self.myCategoryView.cellWidthZoomEnabled = YES;
self.myCategoryView.cellWidthZoomScale = 1.3;
self.myCategoryView.imageSize = CGSizeMake(56, 18);
self.listContainerView.translatesAutoresizingMaskIntoConstraints = NO;
if (!self.isLoading) {
[self uploadSubViews];
}
// Do any additional setup after loading the view.
}
-(void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];
self.listContainerView.frame = CGRectMake(0,self.myCategoryView.bottom, kScreenWidth, self.view.height -kStatusHeight);
if ([CNUserShareManager isLogin]) {
self.myCategoryView.width = kScreenWidth - 45;
self.customChannelsBtn.centerY = self.myCategoryView.centerY;
self.customChannelsBtn.right = kScreenWidth - 18;
}else
{
self.myCategoryView.width = kScreenWidth - 70;
self.loginBtn.centerY = self.myCategoryView.centerY;
self.loginBtn.right = kScreenWidth - 11;
}
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
-(void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear: animated];
[self quitCustomChannels];
}
-(UIStatusBarStyle)preferredStatusBarStyle
{
if (self.currentAtatusColor.intValue == 0) {
self.customChannelsBtn.selected = YES;
return UIStatusBarStyleLightContent;
}else
{
self.customChannelsBtn.selected = NO;
return UIStatusBarStyleDefault;
}
}
- (void)uploadSubViews
{
if (self.currentIndex>=self.titles.count) {
self.currentIndex = 0;
}
for (int i = 0;i<self.imageNames.count;i++) {
NSURL *url = [NSURL URLWithString:self.imageNames[i]];
[self.imageNames replaceObjectAtIndex:i withObject:url];
}
//分类控制器基础配置
self.myCategoryView.titles = self.titles;
self.myCategoryView.delegate = self;
self.myCategoryView.imageURLs = self.imageNames;
self.myCategoryView.defaultSelectedIndex = self.currentIndex;
self.myCategoryView.loadImageCallback = ^(UIImageView *imageView, NSURL *imageURL) {
[imageView sd_setImageWithURL:imageURL];
};
[self updateSelectColors:self.currentIndex];
[self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:self.currentIndex unselectIndex:self.currentIndex];
}
#pragma mark - 通知的监听方法 Notification
// 分类接口请求成功或者失败
- (void)classifyChannelsRequest:(NSNotification *)noti {
[QMUITips hideAllTipsInView:self.view];
[self dataDivideIntoNormalAndOtherWithFirst:NO];
[self handleDateWithChannelsArray];
[self uploadSubViews];
}
// 分类接口数据请求完毕隐藏loading
- (void)classifyChannelsRequestedHideLoading:(NSNotification *)noti {
[QMUITips hideAllTipsInView:self.view];
}
#pragma mark - Action
// 点击定制频道按钮进入定制
- (void)customAction:(UIButton *)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:WjjH5StopVideoPlayerNotification object:nil];
[[NSNotificationCenter defaultCenter] postNotificationName:kDSHappinessPageControlScrollEnableNotification object:@(YES)];
self.hasChanged = NO;
self.isEditing = YES;
if (self.currentAtatusColor.intValue == 0) {
self.oldStatusBar = YES;
self.currentAtatusColor = @"1";
[self setNeedsStatusBarAppearanceUpdate];
} else {
self.oldStatusBar = NO;
}
[self.view addSubview:self.customChannelsV];
[UIView animateWithDuration:animationTime animations:^{
self.customChannelsV.alpha = 1.0;
self.customChannelsV.y = 0;
}];
}
// 登录
- (void)loginAction:(UIButton *)sender {
}
#pragma mark - Method
-(void)updateSelectColors:(NSInteger)index
{
NSString *backgroundImage = [self.bgImages safetyObjectAtIndex:index];
[self.topBgImg sd_setImageWithURL:[NSURL URLWithString:backgroundImage]];
NSString *backgroundColor = [self.bgColors safetyObjectAtIndex:index];
self.topBgImg.backgroundColor = CNLiveColorWithHexString(backgroundColor);
self.myCategoryView.titleColor = self.textColors[index];
self.myCategoryView.titleSelectedColor = self.textColorSeleteds[index];
if (!self.currentAtatusColor || ![self.currentAtatusColor isEqualToString:self.statusBarColors[index]] ) {
self.currentAtatusColor = self.statusBarColors[index];
[self setNeedsStatusBarAppearanceUpdate];
}
}
//配置选中状态显示图片,未选中展示文字
- (void)configCategoryViewWithType:(JXCategoryTitleImageType)imageType selectIndex:(NSInteger)index unselectIndex:(NSInteger)unIndex
{
NSMutableArray *types = [NSMutableArray array];
for (int i = 0; i < self.titles.count; i ++) {
if (i == index || i == unIndex) {
NSURL *url = self.imageNames[i];
NSString *str = [url absoluteString];
if ([str isEqual:@""]) {
[types addObject:@(JXCategoryTitleImageType_OnlyTitle)];
}else{
[types addObject:@(imageType)];
}
}else{
[types addObject:@(JXCategoryTitleImageType_OnlyTitle)];
}
}
self.myCategoryView.imageTypes = types;
for (int i = 0; i < self.titles.count; i ++) {
[self.myCategoryView reloadCellAtIndex:i];
}
}
- (void)dataDivideIntoNormalAndOtherWithFirst:(BOOL)first {
NSArray *channelsArray = [[NSUserDefaults standardUserDefaults] objectForKey:CNLiveNetAddGetCategoryChannels];
NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
NSString *otherKey = [NSString stringWithFormat:@"%@_%@",OtherChannelArray,CNUserShareModel.uid];
NSMutableArray *normalArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:normalKey]];
NSMutableArray *otherArray = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:otherKey]];
// 请求到过数据
if ([NSArray isArray:channelsArray]) {
NSString *newChannelVer = [[NSUserDefaults standardUserDefaults] objectForKey:CNWjjNewCategoryChannelVerKey];
NSString *oldChannelVer = [[NSUserDefaults standardUserDefaults] objectForKey:CNWjjOldCategoryChannelVerKey];
if (CNLiveStringIsEmpty(newChannelVer) || CNLiveStringIsEmpty(oldChannelVer) || [newChannelVer isEqualToString:oldChannelVer]) {// 没有新版本
NSMutableArray *tempAllArray = [[NSMutableArray alloc] initWithArray:channelsArray]; //临时总频道
NSMutableArray *tempOtherArray = [NSMutableArray array];//临时其他频道
NSMutableArray *tempNormalArray = [NSMutableArray array];//临时我的频道
if ([NSArray isArray:otherArray]) {//"其他频道"有数据
// 比较数据并存储
for (NSString *str in otherArray) {//遍历其他频道
NSDictionary *dic = CNLiveStringJsonToDictionary(str);
CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
NSInteger index = [model containsWithChannelArray:tempAllArray];
if (index==-1) {
continue;
}
[tempOtherArray addObject:[tempAllArray safetyObjectAtIndex:index]];
if (index<tempAllArray.count) {
[tempAllArray removeObjectAtIndex:index];
}
}
[otherArray removeAllObjects];
otherArray = tempOtherArray; //新"其他频道"
}
for (NSString *str in normalArray) { //对"我的频道"按本地顺序排序
NSDictionary *dic = CNLiveStringJsonToDictionary(str);
CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
NSInteger index = [model containsWithChannelArray:tempAllArray];
if (index==-1) {
continue;
}
[tempNormalArray addObject:[tempAllArray safetyObjectAtIndex:index]];
if (index<tempAllArray.count) {
[tempAllArray removeObjectAtIndex:index];
}
}
[tempNormalArray addObjectsFromArray:tempAllArray];
[normalArray removeAllObjects];
normalArray = tempNormalArray;
} else {
// 有新版本
normalArray = channelsArray.mutableCopy;
[otherArray removeAllObjects];
}
[[NSUserDefaults standardUserDefaults] setObject:newChannelVer forKey:CNWjjOldCategoryChannelVerKey];
} else { // 从未请求到过数据
if ([BHConfig boolValue:ChannelsRequested]&& first) {
[QMUITips showLoadingInView:self.view];
self.isLoading = YES;
return;
}
// 默认数据
NSMutableArray *defaultArray = [NSMutableArray array];
NSString *jsonName = [CNLiveEnvironmentManager manager].isTestEnvironment?@"wjjCategoryH5Test":@"wjjCategoryH5";
NSString *path = [[NSBundle mainBundle] pathForResource:jsonName ofType:@"json"];
NSData *data = [[NSData alloc] initWithContentsOfFile:path];
NSArray *dataArray = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
for (NSDictionary *dic in dataArray) {
[defaultArray addObject:CNLiveNSDictionaryDicToJson(dic)];
}
NSMutableArray *tempAllArray = [[NSMutableArray alloc] initWithArray:defaultArray];
NSMutableArray *tempOtherArray = [NSMutableArray array];
NSMutableArray *tempNormalArray = [NSMutableArray array];//临时我的频道
if ([NSArray isArray:otherArray]) {//其他频道有数据
// 比较数据并存储
for (NSString *str in otherArray) {
NSDictionary *dic = CNLiveStringJsonToDictionary(str);
CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
NSInteger index = [model containsWithChannelArray:tempAllArray];
if (index==-1) {
continue;
}
[tempOtherArray addObject:[tempAllArray safetyObjectAtIndex:index]];
if (index<tempAllArray.count) {
[tempAllArray removeObjectAtIndex:index];
}
}
[otherArray removeAllObjects];
otherArray = tempOtherArray;
}
for (NSString *str in normalArray) { //对"我的频道"按本地顺序排序
NSDictionary *dic = CNLiveStringJsonToDictionary(str);
CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
NSInteger index = [model containsWithChannelArray:tempAllArray];
if (index==-1) {
continue;
}
[tempNormalArray addObject:[tempAllArray safetyObjectAtIndex:index]];
if (index<tempAllArray.count) {
[tempAllArray removeObjectAtIndex:index];
}
}
[tempNormalArray addObjectsFromArray:tempAllArray];
[normalArray removeAllObjects];
normalArray = tempNormalArray;
[[NSUserDefaults standardUserDefaults] setObject:@"default" forKey:CNWjjOldCategoryChannelVerKey];
}
[[NSUserDefaults standardUserDefaults] setObject:normalArray forKey:normalKey];
[[NSUserDefaults standardUserDefaults] setObject:otherArray forKey:otherKey];
[[NSUserDefaults standardUserDefaults] synchronize];
}
//解析数据
-(void)handleDateWithChannelsArray
{
NSString *normalKey = [NSString stringWithFormat:@"%@_%@",NormalChannelArray,CNUserShareModel.uid];
NSArray *normalArray = [[NSUserDefaults standardUserDefaults] objectForKey:normalKey];
[self.dataArray removeAllObjects];
[self.titles removeAllObjects];
[self.imageNames removeAllObjects];
[self.bgImages removeAllObjects];
[self.bgColors removeAllObjects];
[self.textColors removeAllObjects];
[self.textColorSeleteds removeAllObjects];
[self.statusBarColors removeAllObjects];
for (NSString *str in normalArray) {
NSDictionary *dic = CNLiveStringJsonToDictionary(str);
CNCategoryGetChannelModel *model = [CNCategoryGetChannelModel mj_objectWithKeyValues:dic];
[self.dataArray addObject:model];
[self.titles addObject:model.showName];
if (model.img) {
[self.imageNames addObject:model.img];
}else{
[self.imageNames addObject:@""];
}
if (!CNLiveStringIsEmpty(model.backgroundImg)) {
[self.bgImages addObject:model.backgroundImg];
} else {
[self.bgImages addObject:@""];
}
if (!CNLiveStringIsEmpty(model.backgroundColor)) {
[self.bgColors addObject:model.backgroundColor];
} else {
[self.bgColors addObject:@"#FFFFFF"];
}
if (!CNLiveStringIsEmpty(model.textColor)) {
[self.textColors addObject:CNLiveColorWithHexString(model.textColor)];
} else {
[self.textColors addObject:CNLiveColorWithHexString(@"#848494")];
}
if (!CNLiveStringIsEmpty(model.textColorSelected)) {
[self.textColorSeleteds addObject:CNLiveColorWithHexString(model.textColorSelected)];
} else {
[self.textColorSeleteds addObject:CNLiveColorWithHexString(@"#13CC0C")];
}
if (!CNLiveStringIsEmpty(model.statusBarColor)) {
[self.statusBarColors addObject:model.statusBarColor];
[self setNeedsStatusBarAppearanceUpdate];
}else
{
[self.statusBarColors addObject:@"1"];
}
}
}
-(void)scrollViewUpDowm:(BOOL)isUp
{
[UIView animateWithDuration:0.3 animations:^{
if (isUp) {
[self scrollViewUp];
}else
{
[self scrollViewDown];
}
if ([CNUserShareManager isLogin]) {
self.customChannelsBtn.centerY = self.myCategoryView.collectionView.centerY + kStatusHeight;
}else
{
self.loginBtn.centerY = self.myCategoryView.collectionView.centerY+kStatusHeight;
}
}];
}
-(void)scrollViewUp{
if (self.topBgImg.top<0) {
return;
}
[self managerScrollView:YES];
self.topBgImg.top -= moveHeight;
self.myCategoryView.collectionView.top = -50-kStatusHeight;
self.listContainerView.top = kStatusHeight;
}
-(void)scrollViewDown{
if (self.topBgImg.top==0) {
return;
}
[self managerScrollView:NO];
self.topBgImg.top += moveHeight;
self.myCategoryView.collectionView.top = 0;
self.listContainerView.top = self.myCategoryView.bottom;
}
-(void)managerScrollView:(BOOL)enabled
{
self.listContainerView.scrollView.scrollEnabled = !enabled;
for (UIView *view in self.listContainerView.scrollView.subviews) {
if ([view.viewController isKindOfClass:[CNLiveSubSegmentController class]]) {
CNLiveSubSegmentController *subVc = (CNLiveSubSegmentController *)view.viewController;
[subVc layoutRightSubViewWithShow:!enabled];
}
}
}
#pragma mark - CNCustomChannelListViewDelegate !!!!!!!!!!!!!!!!!!!!!!
- (void)changeChannelsList
{
// "完成"分类频道顺序重排
[self handleDateWithChannelsArray];
[self uploadSubViews];
[self.myCategoryView reloadData];
self.hasChanged = YES;
}
- (void)didSelectedCommonChannelWithIndex:(NSInteger)index
{
[self quitCustomChannels];
[self.myCategoryView selectItemAtIndex:index];
}
- (void)pushToControllerWithIndex:(NSInteger)index
{
// 跳到其他频道的对应页面
// [self goToOtherChannelViewControllerWithIndex:index];
}
- (void)closeCustomChannelsView {
// 关闭定制频道页
[self quitCustomChannels];
}
// 退出定制频道编辑页面
- (void)quitCustomChannels {
self.isEditing = NO;
if (self.oldStatusBar && !self.hasChanged) {
self.oldStatusBar = NO;
self.currentAtatusColor = @"0";
[self setNeedsStatusBarAppearanceUpdate];
}
self.hasChanged = NO;
[UIView animateWithDuration:animationTime animations:^{
self.customChannelsV.alpha = 0.0;
self.customChannelsV.y = animationHeight;
} completion:^(BOOL finished) {
[self.customChannelsV removeFromSuperview];
self.customChannelsV = nil;
}];
}
#pragma mark - JXCategoryViewDelegate
// 正在滚动中的回调,这里调整背景图片的 alpha 透明度
- (void)categoryView:(JXCategoryBaseView *)categoryView scrollingFromLeftIndex:(NSInteger)leftIndex toRightIndex:(NSInteger)rightIndex ratio:(CGFloat)ratio {
[self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:leftIndex unselectIndex:rightIndex];
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
NSLog(@"%@", NSStringFromSelector(_cmd));
self.currentIndex = index;
// 侧滑手势处理
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
[self updateSelectColors:index];
[self configCategoryViewWithType:JXCategoryTitleImageType_OnlyImage selectIndex:index unselectIndex:index];
}
#pragma mark - JXCategoryListContainerViewDelegate
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index
{
CNCategoryGetChannelModel *model = self.dataArray[index];
BOOL isBlack = NO;
if (CNLiveStringIsEmpty(model.statusBarColor)) {
isBlack = YES;
} else {
isBlack = [model.statusBarColor boolValue];//1 黑色
}
if (model.pageStyleList.count>0) {
self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight);
CNLiveSubSegmentController *subVC = [[CNLiveSubSegmentController alloc] initWithModel:model];
subVC.isBlack = isBlack;
weakself
subVC.scrollViewDidScrollBlock = ^(BOOL isUp) {
[weakSelf scrollViewUpDowm:isUp];
};
return subVC;
}
self.topBgImg.frame = CGRectMake(0, 0, KScreenWidth, self.topBgImgHeight - 50);
CNLiveListManager *list = [CNLiveListManager shareListManager];
UIViewController *listView = [list model:model black:isBlack bgImage:[self.bgImages safetyObjectAtIndex:index] bgColor:model.backgroundColor bgImageH5:model.backgroundImgH5];
list.contentVC = self;
weakself
list.scrollViewDidScrollBlock = ^(BOOL isUp) {
[weakSelf scrollViewUpDowm:isUp];
};
return listView;
}
#pragma mark - Public
-(JXCategoryBaseView *)preferredCategoryView
{
return [[JXCategoryTitleImageView alloc] init];
}
#pragma mark - Getting
-(JXCategoryTitleImageView *)myCategoryView
{
return (JXCategoryTitleImageView *)self.categoryView;
}
- (UIImageView *)topBgImg
{
if (!_topBgImg) {
_topBgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, self.topBgImgHeight)];
_topBgImg.contentMode = UIViewContentModeScaleAspectFill;
}
return _topBgImg;
}
- (UIButton *)customChannelsBtn {
if (!_customChannelsBtn) {
_customChannelsBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 19, 19)];
[_customChannelsBtn setImage:[UIImage loadBundleImage:@"ik_subtitle_more_black"] forState:UIControlStateNormal];
[_customChannelsBtn setImage:[UIImage loadBundleImage:@"ik_subtitle_more_white"] forState:UIControlStateSelected];
[_customChannelsBtn addTarget:self action:@selector(customAction:) forControlEvents:UIControlEventTouchUpInside];
_customChannelsBtn.touchAreaInsets = UIEdgeInsetsMake(20, 20, 20, 20);
}
return _customChannelsBtn;
}
- (CNCustomChannelListView *)customChannelsV {
if (!_customChannelsV) {
_customChannelsV = [[CNCustomChannelListView alloc] initWithFrame:CGRectMake(0, animationHeight, KScreenWidth, KScreenHeight)];
_customChannelsV.backgroundColor = kWhiteColor;
_customChannelsV.alpha = 0;
_customChannelsV.delegate = self;
}
return _customChannelsV;
}
- (UIButton *)loginBtn {
if (!_loginBtn) {
_loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_loginBtn.backgroundColor = RGBA(35, 212, 30, 1);
_loginBtn.frame = CGRectMake(0, 0, 52, 24);
_loginBtn.layer.cornerRadius = 12;
_loginBtn.layer.masksToBounds = YES;
[_loginBtn setTitle:@"登录" forState:UIControlStateNormal];
[_loginBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
_loginBtn.titleLabel.font = [UIFont systemFontOfSize:13];
[_loginBtn addTarget:self action:@selector(loginAction:) forControlEvents:UIControlEventTouchUpInside];
_loginBtn.touchAreaInsets = UIEdgeInsetsMake(8, 8, 8, 8);
}
return _loginBtn;
}
-(NSMutableArray *)imageNames
{
if (!_imageNames) {
_imageNames = [[NSMutableArray alloc] init];
}
return _imageNames;
}
- (NSMutableArray *)bgImages
{
if (!_bgImages) {
_bgImages = [[NSMutableArray alloc] init];
}
return _bgImages;
}
- (NSMutableArray *)bgColors
{
if (!_bgColors) {
_bgColors = [[NSMutableArray alloc] init];
}
return _bgColors;
}
-(NSMutableArray *)textColors
{
if (!_textColors) {
_textColors = [[NSMutableArray alloc] init];
}
return _textColors;
}
-(NSMutableArray *)textColorSeleteds
{
if (!_textColorSeleteds) {
_textColorSeleteds = [[NSMutableArray alloc] init];
}
return _textColorSeleteds;
}
-(NSMutableArray *)dataArray
{
if (!_dataArray) {
_dataArray = [[NSMutableArray alloc] init];
}
return _dataArray;
}
- (NSMutableArray *)statusBarColors
{
if (!_statusBarColors) {
_statusBarColors = [[NSMutableArray alloc] init];
}
return _statusBarColors;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end