// // YYRoomRankVC.m // SweetParty // // Created by bj_szd on 2022/6/8. // #import "YYRoomRankVC.h" #import "SPBangDanDateVC.h" @interface YYRoomRankVC () @property (nonatomic, strong) NSArray *titles; @property (nonatomic, strong) JXCategoryTitleView *categoryView; @property (nonatomic, strong) JXCategoryListContainerView *listContainerView; @property (nonatomic, strong) UIImageView *bgImgV; @end @implementation YYRoomRankVC - (void)viewDidLoad { [super viewDidLoad]; self.titles = @[@"贡献榜", @"魅力榜"]; [self createUI]; } - (void)createUI { self.view.backgroundColor = [kBlackColor colorWithAlphaComponent:0.5]; UIImageView *imgV = [[UIImageView alloc] initWithImage:ImageNamed(@"room_rank_gx")]; [self.view addSubview:imgV]; [self.view sendSubviewToBack:imgV]; self.bgImgV = imgV; [imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.mas_equalTo(0); make.height.mas_equalTo(APPW/375.0*360); }]; [self.view addSubview:self.categoryView]; [self.view addSubview:self.listContainerView]; [self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(10); make.centerX.equalTo(self.view); make.width.mas_equalTo(200); make.height.mas_equalTo(44); }]; [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.categoryView.mas_bottom); make.left.right.bottom.equalTo(self.view); }]; // UIButton *backBtn = [ControlCreator createButton:self.view rect:CGRectZero text:nil font:nil color:nil backguoundColor:nil imageName:@"whiteBack" target:self action:@selector(onDismiss)]; // [backBtn mas_makeConstraints:^(MASConstraintMaker *make) { // make.left.mas_equalTo(7); // make.centerY.equalTo(self.categoryView); // make.width.height.mas_equalTo(30); // }]; } - (void)onDismiss { if (self.onDismissBlock) { self.onDismissBlock(); } } // 分页菜单视图 - (JXCategoryTitleView *)categoryView { if (!_categoryView) { _categoryView = [[JXCategoryTitleView alloc] init]; _categoryView.delegate = self; _categoryView.titleFont = YBMediumFont(14); _categoryView.titleSelectedFont = YBBoldFont(16); _categoryView.titleColor = HEXCOLORA(0x999999, 1); _categoryView.titleSelectedColor = HEXCOLOR(0x333333); _categoryView.contentEdgeInsetLeft = 15; _categoryView.contentEdgeInsetRight = 15; _categoryView.listContainer = self.listContainerView; _categoryView.titles = self.titles; // JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; // lineView.indicatorWidth = 11; // lineView.indicatorHeight = 3.5; // lineView.indicatorCornerRadius = 1.75; // lineView.indicatorColor = HEXCOLOR(0xFFFFFF); // lineView.verticalMargin = 2; // lineView.lineStyle = JXCategoryIndicatorLineStyle_Lengthen; // _categoryView.indicators = @[lineView]; } return _categoryView; } // 列表容器视图 - (JXCategoryListContainerView *)listContainerView { if (!_listContainerView) { _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; } return _listContainerView; } - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { if (index == 0) { self.bgImgV.image = ImageNamed(@"room_rank_gx"); }else if (index == 1) { self.bgImgV.image = ImageNamed(@"room_rank_ml"); } } #pragma mark - JXCategoryListContainerViewDelegate // 返回列表的数量 - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView { return self.titles.count; } // 返回各个列表菜单下的实例,该实例需要遵守并实现 协议 - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { SPBangDanDateVC *list = [[SPBangDanDateVC alloc] init]; list.rid = self.rid; list.type = index+1; return list; } @end