// // LVMainViewController.m // xplan-ios // // Created by duoban on 2023/12/18. // #import "LVMainViewController.h" #import #import #import "XPNewHomeNavView.h" @interface LVMainViewController () @property (nonatomic, strong) JXCategoryTitleView *titleView; @property (nonatomic, strong) JXPagerView *pagingView; @property (nonatomic, strong) NSArray *titles; @property (nonatomic, strong) UIStackView *stackView; ///导航栏 @property (nonatomic, strong) XPNewHomeNavView *homeNavView; @end @implementation LVMainViewController - (void)viewDidLoad { [super viewDidLoad]; [self installUI]; [self installConstraints]; } -(void)installUI{ [self.view addSubview:self.stackView]; [self.view addSubview:self.pagingView]; [self.stackView addArrangedSubview:self.titleView]; } -(void)installConstraints{ [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.mas_equalTo(0); make.height.mas_equalTo(kNavigationHeight); }]; [self.pagingView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.bottom.equalTo(self.view); make.bottom.equalTo(self.stackView.mas_bottom); }]; } #pragma mark - 懒加载 - (JXCategoryTitleView *)titleView { if (!_titleView) { _titleView = [[JXCategoryTitleView alloc] init]; _titleView.delegate = self; _titleView.backgroundColor = [UIColor clearColor]; _titleView.titleColor = [ThemeColor textThirdColor]; _titleView.titleSelectedColor = [ThemeColor mainTextColor]; _titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; _titleView.titleSelectedFont = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; _titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter; _titleView.contentScrollViewClickTransitionAnimationEnabled = NO; _titleView.defaultSelectedIndex = 0; _titleView.averageCellSpacingEnabled = NO; _titleView.titles = self.titles; _titleView.cellSpacing = 20; _titleView.listContainer = (id)self.pagingView.listContainerView; JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; lineView.indicatorImageViewSize = CGSizeMake(13, 4); lineView.verticalMargin = 5; lineView.indicatorImageView.image = [UIImage imageNamed:@"home_segment_indicator"]; _titleView.indicators = @[lineView]; } return _titleView; } - (JXPagerView *)pagingView { if (!_pagingView) { _pagingView = [[JXPagerView alloc] initWithDelegate:self]; _pagingView.backgroundColor = [UIColor clearColor]; _pagingView.listContainerView.backgroundColor = [UIColor clearColor]; _pagingView.mainTableView.backgroundColor = [UIColor clearColor]; _pagingView.mainTableView.gestureDelegate = self; _pagingView.listContainerView.listCellBackgroundColor = UIColor.clearColor; } return _pagingView; } - (NSArray *)titles { if (!_titles) { _titles = @[@"派对", @"交友"]; } return _titles; } - (UIStackView *)stackView { if (!_stackView) { _stackView = [[UIStackView alloc] init]; _stackView.axis = UILayoutConstraintAxisHorizontal; _stackView.distribution = UIStackViewDistributionFill; _stackView.alignment = UIStackViewAlignmentCenter; _stackView.spacing = 6; } return _stackView; } - (XPNewHomeNavView *)homeNavView { if (!_homeNavView) { _homeNavView = [[XPNewHomeNavView alloc] init]; _homeNavView.delegate = self; } return _homeNavView; } @end