// // SPWalletContainerVC.m // SweetParty // // Created by bj_szd on 2022/6/10. // #import "SPWalletContainerVC.h" #import "SPWalletJinbiVC.h" #import "SPWalletZuanshiVC.h" #import "SPWalletBoneVC.h" #import "SPWalletRecordVC.h" @interface SPWalletContainerVC () @property (nonatomic, strong) NSArray *titles; @property (nonatomic, strong) JXCategoryTitleView *categoryView; @property (nonatomic, strong) JXCategoryListContainerView *listContainerView; @end @implementation SPWalletContainerVC - (void)viewDidLoad { [super viewDidLoad]; [self showNaviBarWithTitle:@"我的钱包"]; [self onChangeNaviWhiteStyle]; self.titles = @[@"我的金币", @"我的钻石"]; [self createUI]; } -(void)createUI { // UIButton *mingxiBtn = [ControlCreator createButton:self.view rect:CGRectMake(ScreenWidth-44-12, yb_StatusBar_H+12, 44, 20) text:@"明细" font:YBMediumFont(12) color:HEXCOLOR(0x333333) backguoundColor:mainDeepColor imageName:nil target:self action:@selector(onMingxi)]; // mingxiBtn.layer.cornerRadius = 10; [self.view addSubview:self.categoryView]; [self.view addSubview:self.listContainerView]; [self.view sendSubviewToBack:self.listContainerView]; [self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(yb_NavigationBar_H+5); make.centerX.equalTo(self.view); make.width.mas_equalTo(344); make.height.mas_equalTo(42); }]; [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { // make.top.equalTo(self.categoryView.mas_bottom).offset(10); make.top.left.right.equalTo(self.view); make.bottom.equalTo(self.view); }]; } - (void)onMingxi { SPWalletRecordVC *vc = [[SPWalletRecordVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } // 分页菜单视图 - (JXCategoryTitleView *)categoryView { if (!_categoryView) { _categoryView = [[JXCategoryTitleView alloc] init]; _categoryView.titleFont = YBMediumFont(15); _categoryView.titleSelectedFont = YBBoldFont(15); _categoryView.titleColor = HEXCOLOR(0xFFFFFF); _categoryView.titleSelectedColor = HEXCOLOR(0xFEACE9); _categoryView.backgroundColor = HEXCOLORA(0xFFFFFF, 0.1); _categoryView.layer.cornerRadius = 21; _categoryView.layer.masksToBounds = YES; _categoryView.cellSpacing = 0; _categoryView.cellWidth = 344/self.titles.count; _categoryView.averageCellSpacingEnabled = NO; _categoryView.titleLabelMaskEnabled = YES; _categoryView.listContainer = self.listContainerView; _categoryView.titles = self.titles; JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init]; backgroundView.indicatorHeight = 42; backgroundView.indicatorWidthIncrement = 0; backgroundView.indicatorCornerRadius = 21; backgroundView.indicatorColor = kWhiteColor; _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; } // 返回各个列表菜单下的实例,该实例需要遵守并实现 协议 - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { if (0 == index) { SPWalletJinbiVC *list = [[SPWalletJinbiVC alloc] init]; return list; }else if (1 == index) { SPWalletZuanshiVC *list = [[SPWalletZuanshiVC alloc] init]; return list; }else { SPWalletBoneVC *list = [[SPWalletBoneVC alloc] init]; return list; } } @end