12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // YOUPAILZDynamicVC.m
- // VQU
- //
- // Created by Elaine on 2021/7/1.
- // Copyright © 2021 leo. All rights reserved.
- //
- #import "YOUPAILZDynamicVC.h"
- #import "JXCategoryView.h"
- #import "YOUPAIJXCategoryTitleBackgroundView.h"
- #import "JXCategoryListContainerView.h"
- #import "YOUPAILCBaseDynamicVC.h"
- @interface YOUPAILZDynamicVC ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @end
- @implementation YOUPAILZDynamicVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = [UIColor whiteColor];
- [self youpaifinitUI];
- }
- - (void)youpaifinitUI{
- YOUPAIJXCategoryTitleBackgroundView *categoryView = [[YOUPAIJXCategoryTitleBackgroundView alloc] init];//WithFrame:CGRectMake(0.0f, 14.0f, KScreenWidth, 26.0f)
- categoryView.backgroundColor = [UIColor clearColor];
- categoryView.titles = self.titles;
- categoryView.delegate = self;
- categoryView.titleColor = [UIColor whiteColor];
- categoryView.titleColorGradientEnabled = YES;
- categoryView.titleLabelMaskEnabled = YES;
- categoryView.titleFont = LCFont(14.0f);
- categoryView.cellWidth = 50.0f;
- categoryView.cellSpacing = 14.0f;
- categoryView.averageCellSpacingEnabled = NO;
- categoryView.normalBackgroundColor = [HexColorFromRGB(0x4F4B5B) colorWithAlphaComponent:0.38f];
- categoryView.selectedBackgroundColor = [HexColorFromRGB(0xF4003F) colorWithAlphaComponent:0.14f];
- categoryView.cellWidthIncrement = 0;
- categoryView.normalBorderColor = [UIColor clearColor];
- categoryView.selectedBorderColor = [UIColor clearColor];
- categoryView.borderLineWidth = 0;
- categoryView.backgroundCornerRadius = 13.0f;
- categoryView.backgroundWidth = JXCategoryViewAutomaticDimension;
- categoryView.backgroundHeight = 26.0f;
-
- JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
- pagerView.listCellBackgroundColor = LCBkgColor;
- // pagerView.frame = CGRectMake(0.0f, CGRectGetMaxY(categoryView.frame) + 14.0f, KScreenWidth, KScreenHeight - CGRectGetMaxY(categoryView.frame) - NavBarHeight - 10.0f - TabbarHeight - 14.0f);
- [self.view addSubview:pagerView];
- categoryView.listContainer = pagerView;
-
- [self.view addSubview:categoryView];
-
- [categoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.offset(0.0f);
- make.top.offset(14.0f + NavBarHeight + 10.0f);
- make.height.offset(26.0f);
- }];
-
- [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.right.bottom.offset(0.0f);
- make.top.equalTo(categoryView.mas_bottom).offset(14.0f);
- }];
- }
- #pragma mark - JXCategoryListContainerViewDelegate
- - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
- return self.titles.count;
- }
- - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- YOUPAILCBaseDynamicVC *dynamicVC = [[YOUPAILCBaseDynamicVC alloc] init];
- dynamicVC.youpaiptype = [self.types[index] integerValue];
- return dynamicVC;
- }
- - (UIView *)listView{
- return self.view;
- }
- - (NSArray <NSString *> *)titles{
- return @[@"全部",@"关注",@"同城"];
- }
- - (NSArray <NSNumber *> *)types{
- return @[@(1),@(2),@(0)];
- }
- @end
|