Files
featherVoice/QXLive/HomePage(声播)/Controlller/QXRankHomeVC.m
2025-10-25 19:38:29 +08:00

100 lines
4.3 KiB
Objective-C

//
// QXRankHomeVC.m
// IsLandVoice
//
// Created by 启星 on 2025/3/3.
//
#import "QXRankHomeVC.h"
#import "JXCategoryView.h"
#import "QXRankHomeSubVC.h"
@interface QXRankHomeVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
@property (nonatomic,strong)NSArray*titles;
@end
@implementation QXRankHomeVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)setNavgationItems{
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[backBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:RGB16(0xffffff)] forState:(UIControlStateNormal)];
backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
}
-(void)initSubViews{
// if ([QXConfig.backgroundImage hasPrefix:@"http"] || [QXConfig.backgroundImage hasPrefix:@"https"]) {
// [self updateBgImage:QXConfig.backgroundImage];
// }else{
[self updateBgImage:@"home_rank_vc_bg"];
// }
self.view.backgroundColor = [UIColor clearColor];
// self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"];
self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"真爱榜"];
self.listVCArray = [NSMutableArray array];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake(0, 0, SCREEN_WIDTH-100, 44);
self.categoryView.delegate = self;
self.categoryView.titles = self.titles;
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#ffffff"];
self.categoryView.titleColor = [UIColor colorWithHexString:@"#ffffff"];
JXCategoryIndicatorImageView *indicatorImageView = [[JXCategoryIndicatorImageView alloc] init];
indicatorImageView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
indicatorImageView.indicatorWidth = (SCREEN_WIDTH-100)/self.titles.count;
indicatorImageView.indicatorHeight = 5;
self.categoryView.indicators = @[indicatorImageView];
self.categoryView.cellWidth = (SCREEN_WIDTH-100)/self.titles.count;
self.categoryView.contentEdgeInsetLeft = 0;
self.categoryView.cellSpacing = 0;
self.categoryView.titleLabelZoomScale = 1.1;
self.categoryView.titleLabelZoomEnabled = YES;
self.categoryView.titleFont = [UIFont systemFontOfSize:14];
self.categoryView.averageCellSpacingEnabled = NO;
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_ScrollView) delegate:self];
self.containerView.frame = CGRectMake(0, self.categoryView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.categoryView.bottom);
self.navigationItem.titleView = self.categoryView;
[self.view addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
}
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return self.titles.count;
}
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
QXRankHomeSubVC *vc = [[QXRankHomeSubVC alloc] init];
if (index == 3) {
vc.rankType = 4;
}else{
vc.rankType = index;
}
return vc;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}
/*
#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