123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //
- // YOUPAIHRChatRoomDetailVC.m
- // VQU
- //
- // Created by xiaohaoran on 2021/11/2.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAIHRChatRoomDetailVC.h"
- #import "JXCategoryView.h"
- #import "YOUPAIJXCategoryTitleBackgroundView.h"
- #import "JXCategoryListContainerView.h"
- #import "YOUPAIHRChatRoomSubDetailVC.h"
- #import "YOUPAILZLiveCategoryModel.h"
- @interface YOUPAIHRChatRoomDetailVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @property(nonatomic,strong)UICollectionView *collectionView;
- @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView);
- @property (nonatomic, strong) NSArray <YOUPAILZLiveCategoryModel *> *youpaipcategorys;
- @property (nonatomic, strong) NSMutableArray *youpaiptypeArr;
- @end
- @implementation YOUPAIHRChatRoomDetailVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.youpaiptypeArr = [NSMutableArray new];
- [self youpaifrequestCategoryListData];
- }
- - (void)youpaifsetupUI{
- YOUPAIJXCategoryTitleBackgroundView *youpaipcategoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] init];//WithFrame:CGRectMake(0.0f, 14.0f, KScreenWidth, 26.0f)
- youpaipcategoryView.backgroundColor = [UIColor clearColor];
- NSMutableArray <NSString *>*titles = [NSMutableArray array];
- for (YOUPAILZLiveCategoryModel *model in self.youpaipcategorys) {
- [titles addObject:model.youpaiptitle];
- [self.youpaiptypeArr addObject:model.youpaipid];
- }
- youpaipcategoryView.titles = titles.copy;
- youpaipcategoryView.delegate = self;
- youpaipcategoryView.titleColor = [UIColor whiteColor];
- youpaipcategoryView.titleColorGradientEnabled = YES;
- youpaipcategoryView.titleLabelMaskEnabled = YES;
- youpaipcategoryView.titleFont = LCFont(14.0f);
- youpaipcategoryView.cellWidth = 50.0f;
- youpaipcategoryView.cellSpacing = 9;
- youpaipcategoryView.averageCellSpacingEnabled = NO;
- youpaipcategoryView.normalBackgroundColor = HexColorFromRGB(0x4F4B5B);
- youpaipcategoryView.selectedBackgroundColor = HexColorFromRGBA(0xF4003F, 0.14);
- youpaipcategoryView.cellWidthIncrement = 0;
- youpaipcategoryView.contentEdgeInsetLeft = ScaleSize(14);
- youpaipcategoryView.normalBorderColor = [UIColor clearColor];
- youpaipcategoryView.selectedBorderColor = [UIColor clearColor];
- youpaipcategoryView.borderLineWidth = 0;
- youpaipcategoryView.backgroundCornerRadius = 13.0f;
- youpaipcategoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
- youpaipcategoryView.backgroundHeight = 26.0f;
-
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.listCellBackgroundColor = LCBkgColor;
- // pagerView.frame = CGRectMake(0.0f, CGRectGetMaxY(youpaipcategoryView.frame) + 14.0f, KScreenWidth, KScreenHeight - CGRectGetMaxY(youpaipcategoryView.frame) - NavBarHeight - 10.0f - TabbarHeight - 14.0f);
- [self.view addSubview:pagerView];
- youpaipcategoryView.listContainer = pagerView;
-
- [self.view addSubview:youpaipcategoryView];
-
- [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.top.offset(10);
- make.height.offset(28.0f);
- }];
-
- [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.offset(0.0f);
- make.top.equalTo(youpaipcategoryView.mas_bottom).offset(14.0f);
- }];
- }
- - (void)youpaifrequestCategoryListData{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetLiveCateList parameters:@{@"live_type":@"2"} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- @strongify(self);
- self.youpaipcategorys = [YOUPAILZLiveCategoryModel mj_objectArrayWithKeyValuesArray:[dict objectForKey:@"data"]];
- [self youpaifsetupUI];
-
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
-
- }];
- }
- #pragma mark - JXCategoryListContainerViewDelegate
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
- return self.youpaipcategorys.count;
- }
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- YOUPAIHRChatRoomSubDetailVC *vc = [[YOUPAIHRChatRoomSubDetailVC alloc] init];
- vc.youpaiptype = [self.youpaiptypeArr[index] intValue];
- return vc;
- }
- #pragma mark - JXPagingViewListViewDelegate
- - (UIView *)listView{
- return self.view;
- }
- - (UIScrollView *)listScrollView{
- return self.collectionView;
- }
- - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
- self.scrollCallback = callback;
- }
- @end
|