Commit 7160b23d722e3ae7c48686221445b321c99b5709
1 parent
f96206af
新建文件
Showing
2 changed files
with
216 additions
and
0 deletions
CNLiveVideoClassifyKit/Classes/CNVideoList/Controller/CNVideoListsController.h
0 → 100644
CNLiveVideoClassifyKit/Classes/CNVideoList/Controller/CNVideoListsController.m
0 → 100644
| 1 | +// | |
| 2 | +// CNVideoListsController.m | |
| 3 | +// AFNetworking | |
| 4 | +// | |
| 5 | +// Created by iOS on 2023/1/28. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNVideoListsController.h" | |
| 9 | +#import <CNLiveCustomControl/CNLiveNavigationBar.h> | |
| 10 | +#import "CNVideoListsDetailController.h" | |
| 11 | +#import "CNLiveListManager.h" | |
| 12 | + | |
| 13 | +@interface CNVideoListsController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate> | |
| 14 | +@property (nonatomic, strong)UIView *topView; | |
| 15 | +@property (nonatomic, strong)UIButton *backBtn; | |
| 16 | +@property (nonatomic, strong)UIButton *searchBtn; | |
| 17 | +@property (nonatomic, strong)UIButton *personBtn; | |
| 18 | +@property (nonatomic, strong)JXCategoryTitleView *myCategoryView;//头部分组 | |
| 19 | +@property (nonatomic, strong)JXCategoryListContainerView *listContainerView;//分类控制器对应VC管理器 | |
| 20 | +@property (nonatomic, strong)JXCategoryIndicatorLineView *lineView; | |
| 21 | +@property (nonatomic, strong)NSArray *titles;//标题 | |
| 22 | +@end | |
| 23 | + | |
| 24 | +@implementation CNVideoListsController | |
| 25 | + | |
| 26 | +- (void)viewDidLoad { | |
| 27 | + [super viewDidLoad]; | |
| 28 | + self.view.backgroundColor = UIColorWhite; | |
| 29 | + [self.view addSubview:self.topView]; | |
| 30 | + [self.topView addSubview:self.backBtn]; | |
| 31 | + [self.topView addSubview:self.myCategoryView]; | |
| 32 | + [self.topView addSubview:self.searchBtn]; | |
| 33 | + [self.topView addSubview:self.personBtn]; | |
| 34 | + [self.view addSubview:self.listContainerView]; | |
| 35 | + [self.topView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 36 | + make.left.right.equalTo(self.view); | |
| 37 | + make.top.equalTo(self.view).offset(kVerticalStatusHeight); | |
| 38 | + make.height.mas_equalTo(37); | |
| 39 | + }]; | |
| 40 | + [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 41 | + make.left.equalTo(self.topView).offset(10); | |
| 42 | + make.top.bottom.equalTo(self.topView); | |
| 43 | + make.width.mas_equalTo(30); | |
| 44 | + }]; | |
| 45 | + [self.myCategoryView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 46 | + make.top.bottom.centerX.equalTo(self.topView); | |
| 47 | + make.width.mas_equalTo(130); | |
| 48 | + }]; | |
| 49 | + [self.personBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 50 | + make.right.equalTo(self.topView).offset(-15); | |
| 51 | + make.top.bottom.equalTo(self.topView); | |
| 52 | + make.width.mas_equalTo(19); | |
| 53 | + }]; | |
| 54 | + [self.searchBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 55 | + make.right.equalTo(self.personBtn.mas_left).offset(-15); | |
| 56 | + make.top.bottom.equalTo(self.topView); | |
| 57 | + make.width.mas_equalTo(19); | |
| 58 | + }]; | |
| 59 | + [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 60 | + make.left.right.bottom.equalTo(self.view); | |
| 61 | + make.top.equalTo(self.myCategoryView.mas_bottom).offset(0.5); | |
| 62 | + }]; | |
| 63 | +} | |
| 64 | +- (BOOL)preferredNavigationBarHidden{ | |
| 65 | + return YES; | |
| 66 | +} | |
| 67 | +#pragma mark - Action | |
| 68 | +- (void)buttonClickAction:(UIButton *)sender{ | |
| 69 | + switch (sender.tag - 1001) { | |
| 70 | + case 0: | |
| 71 | + { | |
| 72 | + //返回 | |
| 73 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 74 | + } | |
| 75 | + break; | |
| 76 | + case 1: | |
| 77 | + { | |
| 78 | + //搜索 | |
| 79 | + [CNLiveListManager pushWitnessSearchVC]; | |
| 80 | + } | |
| 81 | + break; | |
| 82 | + case 2: | |
| 83 | + { | |
| 84 | + //个人视频 | |
| 85 | + [CNLiveClassifyJumpBridge openPersonMessage:@{@"id":@""}]; | |
| 86 | + } | |
| 87 | + break; | |
| 88 | + | |
| 89 | + default: | |
| 90 | + break; | |
| 91 | + } | |
| 92 | +} | |
| 93 | +#pragma mark - JXCategoryListContainerViewDelegate | |
| 94 | +- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ | |
| 95 | + return self.titles.count; | |
| 96 | +} | |
| 97 | +- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{ | |
| 98 | + | |
| 99 | + CNVideoListsDetailController *vc = [[CNVideoListsDetailController alloc] initWithPageType:index]; | |
| 100 | + return vc; | |
| 101 | +} | |
| 102 | +#pragma mark - JXCategoryViewDelegate | |
| 103 | +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index | |
| 104 | +{ | |
| 105 | + | |
| 106 | +} | |
| 107 | +#pragma mark - Public | |
| 108 | +/** | |
| 109 | + 动态创建分类控制器类型类型 | |
| 110 | + */ | |
| 111 | +-(JXCategoryBaseView *)preferredCategoryView{ | |
| 112 | + return [[JXCategoryTitleView alloc] init]; | |
| 113 | +} | |
| 114 | +/** | |
| 115 | + 返回当前分类控制器高度 | |
| 116 | + */ | |
| 117 | +-(CGFloat)preferredCategoryViewHeight{ | |
| 118 | + return 50; | |
| 119 | +} | |
| 120 | +#pragma mark - getting | |
| 121 | +- (NSArray *)titles | |
| 122 | +{ | |
| 123 | + if (!_titles) { | |
| 124 | + _titles = @[@"关注",@"推荐"]; | |
| 125 | + } | |
| 126 | + return _titles; | |
| 127 | +} | |
| 128 | +- (UIView *)topView{ | |
| 129 | + if (!_topView) { | |
| 130 | + _topView = [[UIView alloc] init]; | |
| 131 | + _topView.backgroundColor = UIColorWhite; | |
| 132 | + } | |
| 133 | + return _topView; | |
| 134 | +} | |
| 135 | +- (UIButton *)backBtn{ | |
| 136 | + if (!_backBtn) { | |
| 137 | + _backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 138 | + [_backBtn setImage:[UIImage loadBundleImage:@"backBlack"] forState:UIControlStateNormal]; | |
| 139 | + _backBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 140 | + _backBtn.tag = 1001; | |
| 141 | + [_backBtn addTarget:self action:@selector(buttonClickAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 142 | + } | |
| 143 | + return _backBtn; | |
| 144 | +} | |
| 145 | +- (UIButton *)searchBtn{ | |
| 146 | + if (!_searchBtn) { | |
| 147 | + _searchBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 148 | + [_searchBtn setImage:[UIImage loadBundleImage:@"classify_search"] forState:UIControlStateNormal]; | |
| 149 | + _searchBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 150 | + _searchBtn.tag = 1002; | |
| 151 | + [_searchBtn addTarget:self action:@selector(buttonClickAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 152 | + } | |
| 153 | + return _searchBtn; | |
| 154 | +} | |
| 155 | +- (UIButton *)personBtn | |
| 156 | +{ | |
| 157 | + if (!_personBtn) { | |
| 158 | + _personBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | |
| 159 | + [_personBtn setImage:[UIImage loadBundleImage:@"classify_person"] forState:UIControlStateNormal]; | |
| 160 | + _personBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; | |
| 161 | + _personBtn.tag = 1003; | |
| 162 | + [_personBtn addTarget:self action:@selector(buttonClickAction:) forControlEvents:UIControlEventTouchUpInside]; | |
| 163 | + } | |
| 164 | + return _personBtn; | |
| 165 | +} | |
| 166 | +- (JXCategoryTitleView *)myCategoryView{ | |
| 167 | + if (!_myCategoryView) { | |
| 168 | + _myCategoryView = [[JXCategoryTitleView alloc] init]; | |
| 169 | + _myCategoryView.backgroundColor = UIColorWhite; | |
| 170 | + _myCategoryView.delegate = self; | |
| 171 | + _myCategoryView.listContainer = self.listContainerView; | |
| 172 | + _myCategoryView.selectedAnimationEnabled = YES; | |
| 173 | + _myCategoryView.titles = self.titles; | |
| 174 | + _myCategoryView.titleFont = UIFontMake(15); | |
| 175 | + _myCategoryView.titleColor = UIColorHex(#999999); | |
| 176 | + _myCategoryView.titleSelectedFont = UIFontMake(15); | |
| 177 | + _myCategoryView.titleSelectedColor = UIColorHex(#333333); | |
| 178 | + _myCategoryView.indicators = @[self.lineView]; | |
| 179 | + _myCategoryView.defaultSelectedIndex = 1; | |
| 180 | + } | |
| 181 | + return _myCategoryView; | |
| 182 | +} | |
| 183 | +- (JXCategoryIndicatorLineView *)lineView | |
| 184 | +{ | |
| 185 | + if (!_lineView) { | |
| 186 | + _lineView = [[JXCategoryIndicatorLineView alloc] init]; | |
| 187 | + _lineView.indicatorWidth = 15; | |
| 188 | + _lineView.indicatorColor = UIColorHex(#25CA5A); | |
| 189 | + } | |
| 190 | + return _lineView; | |
| 191 | +} | |
| 192 | + | |
| 193 | +- (JXCategoryListContainerView *)listContainerView | |
| 194 | +{ | |
| 195 | + if (!_listContainerView) { | |
| 196 | + _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; | |
| 197 | + } | |
| 198 | + return _listContainerView; | |
| 199 | +} | |
| 200 | + | |
| 201 | +@end | ... | ... |