111 lines
4.8 KiB
Objective-C
111 lines
4.8 KiB
Objective-C
//
|
|
// QXDressViewController.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/5/9.
|
|
//
|
|
|
|
#import "QXDressViewController.h"
|
|
#import "JXCategoryView.h"
|
|
#import "QXDressSubViewController.h"
|
|
#import "QXMineNetwork.h"
|
|
#import "QXPropShopViewController.h"
|
|
|
|
@interface QXDressViewController ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
|
|
@property (nonatomic,strong)JXCategoryTitleView *categoryView;
|
|
@property (nonatomic,strong)JXCategoryListContainerView *containerView;
|
|
@property (nonatomic,strong)NSMutableArray <UIViewController*>*listVCArray;
|
|
@property (nonatomic,strong)NSMutableArray *titles;
|
|
@end
|
|
|
|
@implementation QXDressViewController
|
|
|
|
- (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{
|
|
[super setNavgationItems];
|
|
self.navigationItem.title = QXText(@"个性装扮");
|
|
UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
|
[recordBtn setTitle:QXText(@"道具商城") forState:(UIControlStateNormal)];
|
|
[recordBtn setTitleColor:RGB16(0xFF8ACC) forState:(UIControlStateNormal)];
|
|
recordBtn.titleLabel.font = [UIFont systemFontOfSize:16];
|
|
[recordBtn addTarget:self action:@selector(recordAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn];
|
|
}
|
|
|
|
-(void)recordAction{
|
|
QXPropShopViewController *vc = [[QXPropShopViewController alloc] init];
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
|
|
- (void)initSubViews{
|
|
self.view.backgroundColor = [UIColor whiteColor];
|
|
// self.titles = @[QXText(@"头像框"),QXText(@"座驾"),QXText(@"气泡"),QXText(@"个人靓号"),QXText(@"房间靓号"),QXText(@"工会靓号")];
|
|
self.listVCArray = [NSMutableArray array];
|
|
self.categoryView = [[JXCategoryTitleView alloc] init];
|
|
self.categoryView.frame = CGRectMake(15, kSafeAreaTop+44, SCREEN_WIDTH-30, 44);
|
|
self.categoryView.delegate = self;
|
|
// self.categoryView.titles = self.titles;
|
|
self.categoryView.titleSelectedColor = [UIColor colorWithHexString:@"#333333"];
|
|
self.categoryView.titleColor = [UIColor colorWithHexString:@"#666666"];
|
|
self.categoryView.cellWidth = JXCategoryViewAutomaticDimension;
|
|
self.categoryView.contentEdgeInsetLeft = 0;
|
|
self.categoryView.cellSpacing = 18;
|
|
self.categoryView.contentEdgeInsetLeft = 8;
|
|
// self.categoryView.titleLabelZoomScale = 1.1;
|
|
self.categoryView.titleLabelZoomEnabled = YES;
|
|
self.categoryView.titleFont = [UIFont boldSystemFontOfSize:14];
|
|
self.categoryView.titleSelectedFont = [UIFont boldSystemFontOfSize:16];
|
|
self.categoryView.averageCellSpacingEnabled = NO;
|
|
JXCategoryIndicatorImageView *indicatorView = [[JXCategoryIndicatorImageView alloc] init];
|
|
indicatorView.indicatorImageView.image = [UIImage imageNamed:@"home_slider"];
|
|
indicatorView.indicatorImageViewSize = CGSizeMake(40, 8);
|
|
indicatorView.verticalMargin = 11;
|
|
self.categoryView.indicators = @[indicatorView];
|
|
self.containerView = [[JXCategoryListContainerView alloc] initWithType:(JXCategoryListContainerType_CollectionView) 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;
|
|
|
|
}
|
|
-(void)getData{
|
|
MJWeakSelf
|
|
[QXMineNetwork getDressTypeListSuccessBlock:^(NSArray<QXUserDressTypeModel *> * _Nonnull list) {
|
|
[weakSelf.dataArray removeAllObjects];
|
|
[weakSelf.dataArray addObjectsFromArray:list];
|
|
for (QXUserDressTypeModel*model in list) {
|
|
[weakSelf.titles addObject:model.name];
|
|
}
|
|
weakSelf.categoryView.titles = weakSelf.titles;
|
|
[weakSelf.categoryView reloadData];
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
|
|
}];
|
|
}
|
|
-(NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
|
|
return self.dataArray.count;
|
|
}
|
|
-(id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
|
|
QXDressSubViewController *vc = [[QXDressSubViewController alloc] init];
|
|
QXUserDressTypeModel *model = self.dataArray[index];
|
|
vc.model = model;
|
|
return vc;
|
|
}
|
|
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
|
}
|
|
-(NSMutableArray *)titles{
|
|
if (!_titles) {
|
|
_titles = [NSMutableArray array];
|
|
}
|
|
return _titles;
|
|
}
|
|
@end
|