145 lines
5.4 KiB
Objective-C
Executable File
145 lines
5.4 KiB
Objective-C
Executable File
//
|
|
// SPBangDanDateVC.m
|
|
// SweetParty
|
|
//
|
|
// Created by bj_szd on 2022/6/8.
|
|
//
|
|
|
|
#import "SPBangDanDateVC.h"
|
|
#import "SPBangDanListVC.h"
|
|
|
|
@interface SPBangDanDateVC ()<JXCategoryListContainerViewDelegate>
|
|
|
|
@property (nonatomic, strong) NSArray *titles;
|
|
@property (nonatomic, strong) JXCategoryTitleView *categoryView;
|
|
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
|
|
|
|
@end
|
|
|
|
@implementation SPBangDanDateVC
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
self.view.backgroundColor = kClearColor;
|
|
|
|
self.titles = @[@"日榜", @"周榜",@"月榜"];
|
|
|
|
[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(260);
|
|
make.height.mas_equalTo(36);
|
|
}];
|
|
[self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.categoryView.mas_bottom);
|
|
make.left.right.bottom.equalTo(self.view);
|
|
}];
|
|
}
|
|
|
|
// 分页菜单视图
|
|
- (JXCategoryTitleView *)categoryView {
|
|
if (!_categoryView) {
|
|
_categoryView = [[JXCategoryTitleView alloc] init];
|
|
_categoryView.titleFont = YBMediumFont(15);
|
|
_categoryView.titleSelectedFont = YBBoldFont(16);
|
|
_categoryView.titleColor = HEXCOLORA(0x999999, 1);
|
|
if (self.type == 1){
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0xE5A800);
|
|
}else if (self.type == 2){
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0xE100E1);
|
|
}else{
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0x00AEE8);
|
|
}
|
|
|
|
_categoryView.backgroundColor = HEXCOLORA(0xFFFFFF, 0.4);
|
|
|
|
//房间内榜单
|
|
if (self.rid.length > 0) {
|
|
if (self.type == 1) {
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0xE5A800);
|
|
_categoryView.titleColor = HEXCOLORA(0xFFFFFF, 1);
|
|
}else if (self.type == 2) {
|
|
_categoryView.titleSelectedColor = HEXCOLOR(0xE100E1);
|
|
_categoryView.titleColor = HEXCOLORA(0xFFFFFF, 1);
|
|
}
|
|
_categoryView.backgroundColor = HEXCOLORA(0x000000, 0.15);
|
|
}
|
|
// if (self.type == 3) {
|
|
// _categoryView.backgroundColor = HEXCOLORA(0x2B0098, 0.2);
|
|
// }
|
|
_categoryView.layer.cornerRadius = 17.5;
|
|
_categoryView.layer.masksToBounds = YES;
|
|
_categoryView.cellSpacing = 0;
|
|
_categoryView.cellWidth = 260/self.titles.count;
|
|
_categoryView.averageCellSpacingEnabled = NO;
|
|
_categoryView.titleLabelMaskEnabled = YES;
|
|
|
|
_categoryView.listContainer = self.listContainerView;
|
|
_categoryView.titles = self.titles;
|
|
|
|
JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
|
|
backgroundView.indicatorHeight = 36;
|
|
backgroundView.indicatorWidthIncrement = 0;
|
|
backgroundView.indicatorCornerRadius = 18;
|
|
backgroundView.indicatorColor = kWhiteColor;
|
|
// if (self.rid.length > 0) {
|
|
// if (self.type == 1) {
|
|
// backgroundView.indicatorColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(195/2, 35) direction:FXGradientChangeDirectionHorizontal startColor:HEXCOLOR(0xFF5257) endColor:HEXCOLOR(0xFFB172)];
|
|
// }else if (self.type == 2) {
|
|
// backgroundView.indicatorColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(195/2, 35) direction:FXGradientChangeDirectionHorizontal startColor:HEXCOLOR(0xEC80FF) endColor:HEXCOLOR(0x409CFF)];
|
|
// }
|
|
// }
|
|
|
|
// else {
|
|
// if (self.type == 1 || self.type == 3) {
|
|
// backgroundView.indicatorColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(195/2, 35) direction:FXGradientChangeDirectionVertical startColor:HEXCOLOR(0x7757FF) endColor:HEXCOLOR(0xD554FF)];
|
|
// }else if (self.type == 2) {
|
|
// backgroundView.indicatorColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(195/2, 35) direction:FXGradientChangeDirectionVertical startColor:HEXCOLOR(0xFF42B4) endColor:HEXCOLOR(0xFF8ED3)];
|
|
// }
|
|
// }
|
|
|
|
// backgroundView.layer.borderWidth = 1;
|
|
// backgroundView.layer.borderColor = HEXCOLOR(0xFFFFFF).CGColor;
|
|
|
|
_categoryView.indicators = @[backgroundView];
|
|
}
|
|
return _categoryView;
|
|
}
|
|
|
|
// 列表容器视图
|
|
- (JXCategoryListContainerView *)listContainerView {
|
|
if (!_listContainerView) {
|
|
_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
|
}
|
|
return _listContainerView;
|
|
}
|
|
|
|
#pragma mark - JXCategoryListContainerViewDelegate
|
|
|
|
// 返回列表的数量
|
|
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
|
return self.titles.count;
|
|
}
|
|
|
|
// 返回各个列表菜单下的实例,该实例需要遵守并实现 <JXCategoryListContentViewDelegate> 协议
|
|
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
|
SPBangDanListVC *list = [[SPBangDanListVC alloc] init];
|
|
list.rid = self.rid;
|
|
list.type = self.type;
|
|
list.dateType = index+1;
|
|
|
|
return list;
|
|
}
|
|
|
|
#pragma mark - JXCategoryListContentViewDelegate
|
|
|
|
- (UIView *)listView {
|
|
return self.view;
|
|
}
|
|
|
|
@end
|