// // DemoCustomView2.m // Demo // // Created by 路 on 2019/2/20. // Copyright © 2019年 路. All rights reserved. // #import "JLSelectView.h" #define WIDTH (self.bounds.size.width)*1/4 #import "NodeCollectionView.h" #import "NodeCollectionViewCell.h" #import "JLSubCollectionView.h" #import "JLSelectModel.h" #import "MJExtension.h" @interface JLSelectView(){ JLSubCollectionView *_cv; } @property(nonatomic, strong) NodeCollectionView *nodeCV; @property(nonatomic, strong) NSMutableArray *dataSource; @property(nonatomic, assign) NSInteger currentIndex; @property(nonatomic, strong) UIScrollView *contentSV; @property(nonatomic, strong) NSMutableArray *viewData; @property(nonatomic, strong) NSArray *stateArr;//标记分类 @property(nonatomic, strong) NSMutableArray *dataSource2; @end @implementation JLSelectView - (id)init { self = [super init]; if (self) { self.backgroundColor = [UIColor whiteColor]; self.layer.cornerRadius = 10; self.clipsToBounds = YES; /// _dataSource2 = [NSMutableArray arrayWithObjects:@"官方彩",@"传统彩", nil]; } return self; } - (void)layoutSubviews { [super layoutSubviews]; [self creatUI]; } - (void)setDataArray:(NSArray *)dataArray { _dataArray = dataArray; _dataSource = [NSMutableArray array]; for (NSDictionary *dict in dataArray) { [JLSelectModel mj_setupObjectClassInArray:^NSDictionary *{ return @{ @"data" : @"JLSelectItemModel" // @"statuses" : [Status class], }; }]; JLSelectModel *model = [JLSelectModel mj_objectWithKeyValues:dict]; [self.dataSource addObject:model]; } } - (void)creatUI { self.backgroundColor = [UIColor whiteColor]; self.viewData = [NSMutableArray arrayWithCapacity:0]; // self.dataSource = @[@"官方",@"传统"]; //分别标记上面的分类 self.stateArr = @[@"0",@"10"]; [self addSubview:self.nodeCV]; self.contentSV = [UIScrollView new]; self.contentSV.frame = CGRectMake(0, 70, self.bounds.size.width, self.bounds.size.height); //self.contentSV.backgroundColor=[UIColor greenColor]; self.contentSV.delegate = self; [self addSubview:self.contentSV]; self.contentSV.pagingEnabled = YES; self.contentSV.showsHorizontalScrollIndicator = NO; self.contentSV.bounces = NO; for (int i=0; i