148 lines
4.9 KiB
Objective-C
148 lines
4.9 KiB
Objective-C
//
|
|
// YMMineGiftWallViewController.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2022/4/14.
|
|
//
|
|
|
|
#import "XPMineUserInfoGiftWallViewController.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
#import <JXCategoryView/JXCategoryView.h>
|
|
#import <JXCategoryView/JXCategoryIndicatorBackgroundView.h>
|
|
#import <JXCategoryView/JXCategoryListContainerView.h>
|
|
///Tool
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "YUMIMacroUitls.h"
|
|
#import "UIImage+Utils.h"
|
|
///View
|
|
#import "XPMineUserInfoGiftWallSubViewController.h"
|
|
|
|
|
|
@interface XPMineUserInfoGiftWallViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate>
|
|
///分页标题
|
|
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
|
///分页控件
|
|
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
|
///分页lineView
|
|
@property (nonatomic, strong) JXCategoryListContainerView *containerView;
|
|
///普通礼物
|
|
@property (nonatomic,strong) XPMineUserInfoGiftWallSubViewController *normalGiftVC;
|
|
///幸运礼物
|
|
@property (nonatomic,strong) XPMineUserInfoGiftWallSubViewController *luckyGiftVC;
|
|
@end
|
|
|
|
@implementation XPMineUserInfoGiftWallViewController
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.title = YMLocalizedString(@"XPMineUserInfoGiftWallViewController0");
|
|
[self.view addSubview:self.titleView];
|
|
[self.view addSubview:self.containerView];
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.mas_equalTo(self.view);
|
|
make.width.mas_equalTo(100 * 2 + 20);
|
|
make.height.mas_equalTo(30);
|
|
make.top.mas_equalTo(self.view).offset(10);
|
|
}];
|
|
|
|
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.bottom.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.titleView.mas_bottom).offset(10);
|
|
}];
|
|
}
|
|
|
|
#pragma mark - JXCategoryViewDelegate
|
|
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
|
return self.titles.count;
|
|
}
|
|
|
|
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
|
if (index == 0) {
|
|
return self.normalGiftVC;
|
|
} else {
|
|
return self.luckyGiftVC;
|
|
}
|
|
}
|
|
|
|
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
|
|
// 侧滑手势处理
|
|
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (void)setUserUid:(NSString *)userUid {
|
|
_userUid = userUid;
|
|
self.normalGiftVC.userUid = _userUid;
|
|
self.luckyGiftVC.userUid = _userUid;
|
|
}
|
|
|
|
- (JXCategoryTitleView *)titleView {
|
|
if (!_titleView) {
|
|
_titleView = [[JXCategoryTitleView alloc] init];
|
|
_titleView.delegate = self;
|
|
_titleView.titles = self.titles;
|
|
_titleView.backgroundColor = [UIColor clearColor];
|
|
_titleView.titleColor = [DJDKMIMOMColor secondTextColor];
|
|
_titleView.titleSelectedColor = [DJDKMIMOMColor mainTextColor];
|
|
_titleView.titleFont = [UIFont systemFontOfSize:12];
|
|
_titleView.titleSelectedFont = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
|
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
|
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
|
_titleView.defaultSelectedIndex = 0;
|
|
_titleView.cellSpacing = 20;
|
|
_titleView.cellWidthIncrement = 5;
|
|
_titleView.cellWidth = 60;
|
|
_titleView.listContainer = self.containerView;
|
|
|
|
JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init];
|
|
lineView.indicatorImageViewSize = CGSizeMake(60, 8);
|
|
lineView.verticalMargin = 6;
|
|
lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFC000), UIColorFromRGB(0xFFD15A)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(60, 8)];
|
|
lineView.indicatorImageView.layer.masksToBounds = YES;
|
|
lineView.indicatorImageView.layer.cornerRadius = 4;
|
|
_titleView.indicators = @[lineView];
|
|
}
|
|
return _titleView;
|
|
}
|
|
|
|
- (JXCategoryListContainerView *)containerView {
|
|
if (!_containerView) {
|
|
_containerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
|
_containerView.defaultSelectedIndex = 0;
|
|
}
|
|
return _containerView;
|
|
}
|
|
|
|
- (NSArray<NSString *> *)titles {
|
|
if (!_titles) {
|
|
_titles = @[YMLocalizedString(@"XPWishGiftCreateItemViewController0"), YMLocalizedString(@"XPMineUserInfoGiftWallViewController2")];
|
|
}
|
|
return _titles;
|
|
}
|
|
|
|
- (XPMineUserInfoGiftWallSubViewController *)normalGiftVC {
|
|
if (!_normalGiftVC) {
|
|
_normalGiftVC = [[XPMineUserInfoGiftWallSubViewController alloc] init];
|
|
_normalGiftVC.type = GiftWallViewType_Normal;
|
|
}
|
|
return _normalGiftVC;
|
|
}
|
|
|
|
- (XPMineUserInfoGiftWallSubViewController *)luckyGiftVC {
|
|
if (!_luckyGiftVC) {
|
|
_luckyGiftVC = [[XPMineUserInfoGiftWallSubViewController alloc] init];
|
|
_luckyGiftVC.type = GiftWallViewType_Lucky;
|
|
}
|
|
return _luckyGiftVC;
|
|
}
|
|
|
|
@end
|