// // SPGiftRecordVC.m // SweetParty // // Created by bj_szd on 2022/6/15. // #import "SPGiftRecordVC.h" #import "SPGiftRecordListVC.h" @interface SPGiftRecordVC () @property (nonatomic, strong) NSArray *titles; @property (nonatomic, strong) JXCategoryTitleView *categoryView; @property (nonatomic, strong) JXCategoryListContainerView *listContainerView; @end @implementation SPGiftRecordVC - (void)viewDidLoad { [super viewDidLoad]; if (self.type == 1) { [self showNaviBarWithTitle:@"礼物记录"]; }else { [self showNaviBarWithTitle:@"赠送记录"]; } self.titles = @[@"金币礼物", @"背包礼物"]; [self createUI]; } - (void)createUI { [self.view addSubview:self.categoryView]; [self.view addSubview:self.listContainerView]; [self.categoryView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.view).offset(yb_NavigationBar_H+15); make.left.equalTo(self.view).offset(15); make.right.equalTo(self.view).offset(-15); make.height.mas_equalTo(34); }]; [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.categoryView.mas_bottom); make.left.right.bottom.equalTo(self.view); }]; } // 分页菜单视图 - (JXCategoryTitleView *)categoryView { if (!_categoryView) { _categoryView = [[JXCategoryTitleView alloc] init]; _categoryView.titleFont = YBMediumFont(15); _categoryView.titleSelectedFont = YBMediumFont(15); _categoryView.titleColor = HEXCOLOR(0x333333); _categoryView.titleSelectedColor = HEXCOLOR(0x333333); _categoryView.backgroundColor = HEXCOLOR(0xF5F5F5); _categoryView.layer.cornerRadius = 17; _categoryView.layer.masksToBounds = YES; _categoryView.cellSpacing = 0; _categoryView.cellWidth = (ScreenWidth-15*2)/self.titles.count; _categoryView.titleLabelMaskEnabled = YES; _categoryView.listContainer = self.listContainerView; _categoryView.titles = self.titles; JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init]; backgroundView.indicatorHeight = 34; backgroundView.indicatorWidthIncrement = 0; backgroundView.indicatorColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(_categoryView.cellWidth, 34) direction:FXGradientChangeDirectionHorizontal startColor:mainLightColor endColor:mainDeepColor]; backgroundView.indicatorCornerRadius = 0; // JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init]; // lineView.indicatorColor = HEXCOLOR(0xBA63DD); // lineView.indicatorWidth = 20; // lineView.indicatorHeight = 4; // lineView.indicatorCornerRadius = 2; // lineView.verticalMargin = 0; _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 { SPGiftRecordListVC *list = [[SPGiftRecordListVC alloc] init]; list.type = self.type; list.gift_from_type = index+1; return list; } #pragma mark - JXCategoryListContentViewDelegate - (UIView *)listView { return self.view; } @end