// // LFWFindMiddleView.m // YouHuiProject // // Created by xiaoxi on 2018/1/19. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LFWFindMiddleView.h" #import "LFWCollectionView.h" #import "LFWFindMiddleCollectionViewCell.h" static NSString *const cellID = @"LFWFindMiddleCollectionViewCell"; @interface LFWFindMiddleView () @property (nonatomic, strong) UICollectionView *collectionView; @end @implementation LFWFindMiddleView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { self.backgroundColor = [UIColor whiteColor]; [self initSubviews]; } return self; } - (void)initSubviews { CALayer *lineLayer = [CALayer layer]; lineLayer.backgroundColor = [UIColor YHColorWithHex:0xdddddd].CGColor; lineLayer.frame = CGRectMake(0, 0, kScreenWidth, 0.5); [self.layer addSublayer:lineLayer]; UIImageView *iconImageView = [[UIImageView alloc] init]; iconImageView.backgroundColor = [UIColor clearColor]; iconImageView.image = [UIImage imageNamed:@"goods"]; [self addSubview:iconImageView]; UILabel *nameLabel = [[UILabel alloc] init]; nameLabel.backgroundColor = [UIColor clearColor]; nameLabel.text = @"商品分类"; nameLabel.textColor = [UIColor YHColorWithHex:0x222222]; nameLabel.font = [UIFont systemFontOfSize:FITSIZE(12)]; [self addSubview:nameLabel]; [self addSubview:self.collectionView]; [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(FITSIZE(15)); make.centerY.equalTo(nameLabel); make.size.mas_equalTo(CGSizeMake(FITSIZE(12), FITSIZE(12))); }]; [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(iconImageView.mas_right).offset(FITSIZE(8)); make.top.equalTo(self).offset(FITSIZE(16)); }]; [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self); make.top.equalTo(self).offset(FITSIZE(28)); make.right.equalTo(self); make.bottom.equalTo(self); }]; } - (void)setDataSource:(NSMutableArray *)dataSource { _dataSource = dataSource; [self.collectionView reloadData]; } #pragma mark - collectionView - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 1; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return self.dataSource.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { LFWFindMiddleCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath]; LFWFindChannelModel *model = self.dataSource[indexPath.item]; cell.model = model; return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { if ([self.delegate respondsToSelector:@selector(yh_FindMiddleViewDidSelectItemAtIndexPath:)]) { [self.delegate yh_FindMiddleViewDidSelectItemAtIndexPath:indexPath]; } } #pragma mark - lazy - (UICollectionView *)collectionView { if (!_collectionView) { UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical; flowLayout.itemSize = CGSizeMake(kScreenWidth/4, FITSIZE(66)); flowLayout.minimumLineSpacing = FITSIZE(26); flowLayout.minimumInteritemSpacing = FITSIZE(0); flowLayout.sectionInset = UIEdgeInsetsMake(FITSIZE(26), 0, FITSIZE(16), 0); _collectionView = [[LFWCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:flowLayout]; _collectionView.scrollEnabled = NO; _collectionView.bounces = NO; _collectionView.showsVerticalScrollIndicator = NO; _collectionView.delegate = self; _collectionView.dataSource = self; [_collectionView registerClass:[LFWFindMiddleCollectionViewCell class] forCellWithReuseIdentifier:cellID]; } return _collectionView; } -(void)aI4a9iSsnJ:(UIActivity*) aI4a9iSsnJ as61ECB:(UIBarButtonItem*) as61ECB a1VDQ:(UIViewController*) a1VDQ ahMml9:(UICollectionView*) ahMml9 aKiLg:(UIMotionEffect*) aKiLg atPTQD:(UIFontWeight*) atPTQD aHRE8nMNXjJ:(UISwitch*) aHRE8nMNXjJ al49YD8pX:(UIWindow*) al49YD8pX aCfDzb1:(UIUserInterfaceIdiom*) aCfDzb1 ajQ0BOM:(UIMotionEffect*) ajQ0BOM aUry8vsMwP:(UIVisualEffectView*) aUry8vsMwP afPRU43p:(UIScreen*) afPRU43p aPSvYMbhcWO:(UITableView*) aPSvYMbhcWO aJdWR2S:(UIRegion*) aJdWR2S aoQ6BCxgO:(UIWindow*) aoQ6BCxgO axuTbr:(UIViewController*) axuTbr { NSLog(@"sOu0XBAqcM2RHelxEChva"); NSLog(@"dDfHQJVws1lgv725B"); NSLog(@"qBZu3vc6G4p7rtN8VXTIYzFjy1RxlH"); NSLog(@"GokeHpLsbFt5gqdV837NJcCnaAI4PDujMylU"); NSLog(@"3ruxyStbNMQhpgC0dozcPsJ2"); NSLog(@"bVfLSJM1v8cdE5ePy4mkr6sFGz"); NSLog(@"0nhi2fjRw4F7"); NSLog(@"zrLC6kc3iGv9yHn7ofK0sD15hFQqJAEuaVIXZU"); NSLog(@"r2ZgKnEk1vyNjf4W7bdC9HaRILBAqYXeMzVp8xS"); NSLog(@"4R38xTjw6SVg1rYaMutKFlz"); NSLog(@"0a32giphFfDrHBwvReIKQdGoxNjPZnAJuzU5YE"); NSLog(@"87VK1AZdQcfzsmXwBDyN6kCP5FLvtejbul"); NSLog(@"auY78yzDbBvHZhx"); NSLog(@"oh1LEAXUWHek3KSDVtG8TZp9gOYmsd5Ju4P"); NSLog(@"WvTlL5DZ6StYIq0RgkJij91oenu"); NSLog(@"kfIFKHb4QViS0pcuyLXYj1TURGMaxZvzg"); NSLog(@"cukX1xlEjaiVHRqJ46snt9Gz0rQvbSh5FgM2N"); } -(void)aRjJ5Bv:(UIFont*) aRjJ5Bv aA2H3:(UIMenuItem*) aA2H3 aGiuOq8d:(UIControlEvents*) aGiuOq8d aV9cA:(UIUserInterfaceIdiom*) aV9cA azxnvAClHh:(UIAlertView*) azxnvAClHh a8Ch9q21:(UIKeyCommand*) a8Ch9q21 { NSLog(@"80Mr3vjfiYhG"); NSLog(@"yzCaRfiThUuKwSbcFYp"); NSLog(@"Zpe6wdCQTjXcJE0327SzGAovBUma"); NSLog(@"bYk2wM5AjzqhJUR"); NSLog(@"uO9dCkMfHBX2wGtR51NDzWcoLsKU0"); NSLog(@"0ABer5izfOZ8gv4Wk3lyjmtTFn"); NSLog(@"tPz3n2yadeOQuGqpR69lU81mwF0viXgZh"); NSLog(@"BmT9qRalKWAoV"); NSLog(@"5uMIlmfQvSWXkVp"); NSLog(@"4Jgrmw952uofpHTFR8QPI6SWqby1s3vMtL"); NSLog(@"GLqFsvE02A5NtnXTbC74Vu"); NSLog(@"kHzJ91LuXhEWQR3N6YbPBA70DtVm"); NSLog(@"Ry5d9lUNOgFr7JuYh08t"); NSLog(@"2umOrqMF0TjzvL3KdPsQUB"); } -(void)arQXm:(UIVisualEffectView*) arQXm a0WVl:(UIKeyCommand*) a0WVl ajoW8OK:(UIEdgeInsets*) ajoW8OK aiyJf:(UIImageView*) aiyJf agOnNzY:(UIScreen*) agOnNzY an8zKyJl5:(UIDocument*) an8zKyJl5 aGgKnRk7oF:(UIRegion*) aGgKnRk7oF aZJvm2u:(UIBezierPath*) aZJvm2u abrMoK7tW:(UIDevice*) abrMoK7tW atUlmg7oTD:(UIMenuItem*) atUlmg7oTD auGaK7gZB:(UIAlertView*) auGaK7gZB aHlqOP:(UITableView*) aHlqOP aPTAdj:(UIBarButtonItem*) aPTAdj aw6XI9ELM:(UIView*) aw6XI9ELM aO8bs:(UIBarButtonItem*) aO8bs { NSLog(@"syoWE8Q6Rqd1lI"); NSLog(@"5972Fi0KbYrf8oedaxEq6Sh3VOCpW4LHgny"); NSLog(@"kVfN9RQJ2C0OlaDbtiEAujPHLMn7oeYypI"); NSLog(@"cYaHTsBCtKnel8bzZ1pOGWrgJXQV6fk"); NSLog(@"IszWne3qLjTpYPa8NQGhgcDlyE1bo6VJAUtSiHCM"); NSLog(@"AxsZEQ6zHeYtbLB"); NSLog(@"B5AIHMlWcuSgnOTa"); NSLog(@"IbeHY5iCXtUjnfVkG"); NSLog(@"2qWsu7rIe1QtB"); NSLog(@"iT37XdhyRn0FQaBurYxeNS"); NSLog(@"4aQxogEDO0A"); NSLog(@"pi92RxeDmglKn170aLz8f6h"); NSLog(@"foxVtFaiOAJG9TeH5KNw"); NSLog(@"bHfGM7Byam5CZ"); NSLog(@"58faJPm7lbKkCQj3ZpyTMHzNoBrOgLV"); NSLog(@"yLQGAWU4Vxr7MY"); } @end