Files
featherVoice/QXLive/Mine(音域)/Controller/礼物墙/QXGiftWallViewController.m
2025-11-11 17:19:21 +08:00

120 lines
4.8 KiB
Objective-C

//
// QXGiftWallViewController.m
// QXLive
//
// Created by 启星 on 2025/11/5.
//
#import "QXGiftWallViewController.h"
#import "QXGiftWallSubViewController.h"
#import "QXMineNetwork.h"
@interface QXGiftWallViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
@property (nonatomic,strong)NSArray*titles;
@property (nonatomic,strong)QXGiftWallSubViewController *lightVC;
@property (nonatomic,strong)QXGiftWallSubViewController *grayVC;
@end
@implementation QXGiftWallViewController
- (void)viewDidLoad {
self.isNoChangeBgImage = YES;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)};
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)};
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationItem.title = @"礼物墙";
}
-(void)initSubViews{
// if ([QXConfig.backgroundImage hasPrefix:@"http"] || [QXConfig.backgroundImage hasPrefix:@"https"]) {
// [self updateBgImage:QXConfig.backgroundImage];
// }else{
[self updateBgImage:@"home_rank_vc_bg"];
// }
self.navigationTintColor = RGB16(0xffffff);
self.view.backgroundColor = [UIColor clearColor];
// self.titles = @[@"房间榜", @"财富榜", @"魅力榜",@"公会榜",@"真爱榜"];
self.titles = @[@"已点亮", @"未点亮"];
self.listVCArray = [NSMutableArray array];
self.categoryView = [[JXCategoryTitleView alloc] init];
self.categoryView.frame = CGRectMake(16, NavContentHeight, SCREEN_WIDTH, 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 = JXCategoryViewAutomaticDimension;
self.categoryView.contentEdgeInsetLeft = 5;
self.categoryView.cellSpacing = 20;
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.view addSubview: self.categoryView];
[self.view addSubview:self.containerView];
self.categoryView.listContainer = self.containerView;
[self getGiftWall];
}
-(void)getGiftWall{
MJWeakSelf
[QXMineNetwork userGiftWallithUserId:self.userId successBlock:^(NSArray<QXUserGiftWallModel *> * _Nonnull lightList, NSArray<QXUserGiftWallModel *> * _Nonnull grayList) {
weakSelf.lightVC.giftArray = lightList;
weakSelf.grayVC.giftArray = grayList;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
return self.titles.count;
}
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
if (index == 0) {
return self.lightVC;
}else{
return self.grayVC;
}
}
-(QXGiftWallSubViewController *)lightVC{
if (!_lightVC) {
_lightVC = [[QXGiftWallSubViewController alloc] init];
_lightVC.isLight = YES;
}
return _lightVC;
}
-(QXGiftWallSubViewController *)grayVC{
if (!_grayVC) {
_grayVC = [[QXGiftWallSubViewController alloc] init];
_grayVC.isLight = NO;
}
return _grayVC;
}
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}
@end