// // QXRankHomeVC.m // IsLandVoice // // Created by 启星 on 2025/3/3. // #import "QXRankHomeVC.h" #import "JXCategoryView.h" #import "QXRankHomeSubVC.h" @interface QXRankHomeVC () @property (nonatomic,strong)JXCategoryTitleView *categoryView; @property (nonatomic,strong)JXCategoryListContainerView *containerView; @property (nonatomic,strong)NSMutableArray *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)initSubViews{ self.view.backgroundColor = [UIColor whiteColor]; // 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:@"#333333"]; self.categoryView.titleColor = [UIColor colorWithHexString:@"#999999"]; 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)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