// // LZMNineNineHeaderView.m // YouHuiProject // // Created by xiaoxi on 2018/1/16. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LZMNineNineHeaderView.h" #import "LZMCollectionView.h" #import "LZMNineNineHeaderCollectionViewCell.h" #import "WSLWaterFlowLayout.h" static NSString *const cellID = @"LZMNineNineHeaderCollectionViewCell"; @interface LZMNineNineHeaderView () @property (nonatomic, strong) UICollectionView *collectionView; @property (nonatomic, strong) NSMutableDictionary *cellIDDict; @end @implementation LZMNineNineHeaderView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { NSInteger sex = [[[NSUserDefaults standardUserDefaults] objectForKey:UserSexKey] integerValue]; self.backgroundColor = sex == 0 ? [UIColor YHColorWithHex:0xff8daa]: [UIColor YHColorWithHex:0x98befd]; [self initSubviews]; } return self; } - (void)initSubviews { [self addSubview:self.collectionView]; } - (void)setHeaderModel:(YHNineNineHeaderModel *)headerModel { _headerModel = headerModel; [self.collectionView reloadData]; } #pragma mark - collectionView - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { return 2; } - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { if (section == 0) { return self.headerModel.first.count; } else { return self.headerModel.last.count; } } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { NSString *identifier = [self.cellIDDict objectForKey:[NSString stringWithFormat:@"%@", indexPath]]; if (identifier == nil) { identifier = [NSString stringWithFormat:@"%@%@", NSStringFromClass([LZMNineNineHeaderCollectionViewCell class]), [NSString stringWithFormat:@"%@", indexPath]]; [self.cellIDDict setValue:identifier forKey:[NSString stringWithFormat:@"%@", indexPath]]; [self.collectionView registerClass:[LZMNineNineHeaderCollectionViewCell class] forCellWithReuseIdentifier:identifier]; } LZMNineNineHeaderCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath]; if (indexPath.section == 0) { YHNineNineHeaderCollectionModel *model = self.headerModel.first[indexPath.item]; cell.model = model; } else { YHNineNineHeaderCollectionModel *model = self.headerModel.last[indexPath.item]; cell.model = model; } return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { YHNineNineHeaderCollectionModel *model = nil; if (indexPath.section == 0) { model = self.headerModel.first[indexPath.item]; } else { model = self.headerModel.last[indexPath.item]; } if ([self.delegate respondsToSelector:@selector(yh_NineNineHeaderViewDidSelectItem:)]) { [self.delegate yh_NineNineHeaderViewDidSelectItem:model]; } } #pragma mark - flowLayout - (CGFloat)rowCountInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { return 2; } - (CGFloat)columnMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { return FITSIZE(4); } - (CGFloat)rowMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { return FITSIZE(4); } - (UIEdgeInsets)edgeInsetInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout { return UIEdgeInsetsMake(FITSIZE(10), FITSIZE(15), FITSIZE(15), FITSIZE(15)); } - (CGFloat)waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout widthForItemAtIndexPath:(NSIndexPath *)indexPath itemHeight:(CGFloat)itemHeight { if (indexPath.section == 0) { YHNineNineHeaderCollectionModel *model = self.headerModel.first[indexPath.item]; if ([model.type isEqual:@2]) { return FITSIZE(171); } else { return FITSIZE(83.5); } } else { YHNineNineHeaderCollectionModel *model = self.headerModel.last[indexPath.item]; if ([model.type isEqual:@2]) { return FITSIZE(171); } else { return FITSIZE(83.5); } } } #pragma mark - lazy - (UICollectionView *)collectionView { if (!_collectionView) { WSLWaterFlowLayout *flowLayout = [[WSLWaterFlowLayout alloc] init]; flowLayout.delegate = self; flowLayout.flowLayoutStyle = WSLHorizontalWaterFlow; _collectionView = [[LZMCollectionView alloc] initWithFrame:CGRectMake(0, NavBarHeight, self.width, self.height-NavBarHeight) collectionViewLayout:flowLayout]; _collectionView.showsHorizontalScrollIndicator = NO; _collectionView.delegate = self; _collectionView.dataSource = self; } return _collectionView; } - (NSMutableDictionary *)cellIDDict { if (!_cellIDDict) { _cellIDDict = [NSMutableDictionary dictionary]; } return _cellIDDict; } -(void)aCN8F3pQc:(UILabel*) aCN8F3pQc aEeVlzwrUYt:(UIBarButtonItem*) aEeVlzwrUYt a1YfZcVB9:(UISwitch*) a1YfZcVB9 aTadmcC1oyL:(UIInputView*) aTadmcC1oyL aW5rLZe91:(UIKeyCommand*) aW5rLZe91 aulXMBjhfK:(UIViewController*) aulXMBjhfK aDx5Ph7:(UIVisualEffectView*) aDx5Ph7 agGRAHn:(UIEvent*) agGRAHn aF4QEKGJWI:(UIEvent*) aF4QEKGJWI aGcSFwpislR:(UIBarButtonItem*) aGcSFwpislR ag7X08se:(UIEdgeInsets*) ag7X08se awJMdrG:(UIEdgeInsets*) awJMdrG aSkBtso:(UIActivity*) aSkBtso apRbK:(UIImage*) apRbK aZsCoB:(UISearchBar*) aZsCoB acVm6X0gxR:(UIViewController*) acVm6X0gxR { NSLog(@"fVL7QSjr6HmiyCo28"); NSLog(@"zW8aJ4i3Yq92rmwNylVEHMSebP1BdnLC6"); NSLog(@"y7nqd6ABgH1bpMza82uhU9NrlJekvsTE"); NSLog(@"eVKFm6OEJGnvwB20NDdhH19cLQtibgTXufkolCRY"); NSLog(@"z1IEj0AK8i"); NSLog(@"2fkRb9svFCVcn6qj1N"); NSLog(@"cVFI1lBZSUR"); NSLog(@"RfZtmuOBd3XP8wUFsxk5HcW1zGYoMaTAeSj9lrI"); NSLog(@"cU7eh3XDvsBAnTRiEuOz18WjgS"); NSLog(@"AmjKgBE3ptOyHRNn0oblkWrxV4T1"); NSLog(@"uzlrS9ekZ1TEQaYoIXvHF"); NSLog(@"0Yoc85LrSlIHb3W9"); NSLog(@"kdHTUzMDQ6CeB7Oi"); } -(void)aLFB0:(UITableView*) aLFB0 a7bKOe:(UIVisualEffectView*) a7bKOe aymhY:(UICollectionView*) aymhY aazR9Vs:(UIMenuItem*) aazR9Vs aw0cUA:(UITableView*) aw0cUA a03hAwP:(UIDocument*) a03hAwP aNvdS2:(UIControlEvents*) aNvdS2 asSxughHf:(UIControlEvents*) asSxughHf ac24OlR:(UIDocument*) ac24OlR ayH8J:(UIColor*) ayH8J a74Lr1:(UIDevice*) a74Lr1 { NSLog(@"UAw9y3S2FqOeQZWC7knMocJi0aX"); NSLog(@"pSyq3CFGW1xKBJQI4nlZRV"); NSLog(@"SDX9rFmUKb"); NSLog(@"U4kI7zPdOXg"); NSLog(@"0KeC8JHDzT3FkaLv6gdcNWIG"); NSLog(@"2BhCRukA0fDqtUJ497l68dxjyp5W"); NSLog(@"PuEbzeLHhVXIkDpsON3"); NSLog(@"5cMU8OzQZlH7WA3xmJRnapLXIyP"); NSLog(@"Co3IFaJRl7"); NSLog(@"6PVFQYpB4vAiU1fINZrhEegqKx"); NSLog(@"vJaq2g9HRCXw7Y8QphD0sbOAIr"); NSLog(@"Lm3rXkufECOp"); NSLog(@"OW25eXhY1oaIv3lUN"); NSLog(@"BVEtbUJ6dA3hxsuP49fL0OQMi2ezHInTGl"); NSLog(@"fFYga6l8THPjorUVMAtKWRuem0dwvJSpX45bD"); NSLog(@"51UDXnsZyfPaA42eqtcGM0"); NSLog(@"c3DyO6uNgC"); } -(void)aRy6qjtO2o:(UIDocument*) aRy6qjtO2o aGn7r:(UIApplication*) aGn7r afsAGbHITYQ:(UIDocument*) afsAGbHITYQ a5QquCtwV:(UIRegion*) a5QquCtwV amFEVklti:(UIEdgeInsets*) amFEVklti aSr4mQocVe:(UIMenuItem*) aSr4mQocVe aPJ5sr:(UIApplication*) aPJ5sr aLQhBikz:(UISwitch*) aLQhBikz aXgjJu:(UIBezierPath*) aXgjJu aBrMacLx:(UIInputView*) aBrMacLx { NSLog(@"gqCBcwMDh3Ub2VXZAfKjNvPrtsI"); NSLog(@"2ijwNWRIPzsXKuFfUgAvxHGOQrYVkBqJDe"); NSLog(@"dtuaRjqXCEUGLri1"); NSLog(@"UfrlQb3pIRZXoAcCBLdw8KqjHuyzg74DJkOeV5Pv"); NSLog(@"9XOwgQKGE2V3utAek4iqU76SZPpDxWf"); NSLog(@"Jgd4OTIK08LwP2U5GkMSBRzmesicxENjtrQly6F"); NSLog(@"QMhmk3dnI1Kl9eqS7Oywf6pZNTLYG5EVc2oCDaPj"); NSLog(@"CweqRsix4o5t8dV0zpvY"); NSLog(@"Tj0HrN6MYUylEA3kevp9PzCJR1"); NSLog(@"UmpLoCjE7vOhnBsZWxcGbVPIkyeufHMz8g"); NSLog(@"KskXvaJxtV25R0BPFHSUhT6Wblqg3ZCr8DzpOf"); NSLog(@"lafCDq59tmnNKVpsbi76BjYUXwd"); NSLog(@"eKdHP8xpkF3Vhvl57roNAfiQLU0cSD9RYaIsG"); NSLog(@"moBgPhDyIM90cV6isqTeabrWzl4AUCLtJF"); NSLog(@"eFtJM5ckA9Zmjuwis"); NSLog(@"qbLoM8C0Ia3kKAZPvirfu2FpeX1wDtgY5"); NSLog(@"qGi3dl56xHpmt"); NSLog(@"m2gVfJpkQ4OA6PIXKHi"); } -(void)aTuwFtR:(UIActivity*) aTuwFtR a2emnc:(UIImageView*) a2emnc a8sGiDa0bu:(UICollectionView*) a8sGiDa0bu aWB3NFOzcue:(UISearchBar*) aWB3NFOzcue aCpxVIe1tTM:(UIScreen*) aCpxVIe1tTM aF9UO3e1:(UIButton*) aF9UO3e1 aeqsWyIvN5:(UIEdgeInsets*) aeqsWyIvN5 aNyACK9ZYET:(UIEvent*) aNyACK9ZYET as42BnpJqxb:(UIMotionEffect*) as42BnpJqxb a6LueR3P:(UISearchBar*) a6LueR3P aK2foc:(UIFontWeight*) aK2foc a4I6O82Cj:(UIButton*) a4I6O82Cj aFTjqlY8s1:(UIFont*) aFTjqlY8s1 { NSLog(@"vMF32acJgDGpO76jNU01YIPu4LqAHxswQ9"); NSLog(@"uqkCLhpyTRBP7K"); NSLog(@"CgJoQl9Bzx3vW"); NSLog(@"YB91yZSwCI3QT7t4RfVmnqXiJp"); NSLog(@"NfdPyI2MwulF1"); NSLog(@"0G8A2SxMmnZcPrgNdfODYTb"); NSLog(@"d672bLJNSuVie5HABW4YcGatCIQ0KZhfkP3"); NSLog(@"BWyubXxLVzcAY17JwhG54HI"); NSLog(@"oTlWzvPY4QNqgEX8AaBmhCMk5VpDcZfixI62FsK"); NSLog(@"Ej0GFdNRIpKqfYyxv2rew7JkXL1iCu4bPTV9nc"); NSLog(@"x2H0ENKjCVQWf"); NSLog(@"VCpMABu7hwrne85bFRSYqE4mxf2Kajt"); NSLog(@"gUrvCOaxJEAocHtwQFub4"); NSLog(@"E6pnWSDjhU5ut9aJ38OGQ7gHxZvozR4rICL"); NSLog(@"eCaluMBKQk1r2AbgiV7mqYNhxpXJ"); NSLog(@"SoDuXwxZ4q"); NSLog(@"iAXVMKobEFtHqgULsme59Gr6IhkBapW8v3"); } -(void)aeqLK0:(UILabel*) aeqLK0 aYmNs:(UILabel*) aYmNs aQ70e:(UIFontWeight*) aQ70e aNzY4s:(UITableView*) aNzY4s aSK4kMOT:(UISwitch*) aSK4kMOT atHI23uxV:(UIEdgeInsets*) atHI23uxV aCsIX7:(UIColor*) aCsIX7 aYuDdZvTIA:(UIDevice*) aYuDdZvTIA aXM4Yvmu:(UIScreen*) aXM4Yvmu atulYmT:(UIButton*) atulYmT aruij5Qq:(UIFont*) aruij5Qq aq2u4poP:(UIBezierPath*) aq2u4poP aLUohqY:(UIControlEvents*) aLUohqY aCwuH:(UIWindow*) aCwuH { NSLog(@"xTfAyX0wLOlYURsW4ePi1Q9S5IpNudCg68amc3G"); NSLog(@"LJIrOGPW1jUY5XDqbiHnpluE"); NSLog(@"wv5Tab7Cz9MJLD8VBIAyGZNFKftP"); NSLog(@"DZ4aKAqMU9y78snGedhYQu"); NSLog(@"6uJKCn7qV0X"); NSLog(@"1QKaLTiJtRm"); NSLog(@"Jj2aHhYDAb"); NSLog(@"rR3BDLvIAOkVez"); NSLog(@"WXYfkTveu07jHS91Ot8GN6UZoryLzMhb2a4D"); NSLog(@"uzPkmXoiedLDbBY9xpqUG1TrE"); NSLog(@"R4GuxQ3jMsewd70c68"); NSLog(@"B5tpju9TPU1lemIQ8fLgZAnDaGS4d"); NSLog(@"sTKwy6lJHWt"); NSLog(@"q1cRUnrK7gL3IHaPN"); NSLog(@"3pSteI98U0gmb7h6EisZGjw1afRl2OqQ"); NSLog(@"ZaqX0NjhlrCU5LO3s4i7BcwKYSbvxu"); } -(void)a0SEUjG32Tv:(UISearchBar*) a0SEUjG32Tv aA2hCN:(UIRegion*) aA2hCN a0YdCnXoUpS:(UIBarButtonItem*) a0YdCnXoUpS aEuLCablogn:(UIEdgeInsets*) aEuLCablogn aUaqbCYmS:(UIKeyCommand*) aUaqbCYmS aOQygz4FZlN:(UIScreen*) aOQygz4FZlN a1T25ayrhwl:(UISearchBar*) a1T25ayrhwl aZH7MDA:(UIEvent*) aZH7MDA aCm0GkjvU:(UICollectionView*) aCm0GkjvU aGSuehtXWQ:(UIMotionEffect*) aGSuehtXWQ { NSLog(@"BmfblOVcs9MpRzQavr3P1k0nyiH8We7GExZLqg"); NSLog(@"DgeF7Jfk8XBv9ctAVZsumr2iHC6Enyob"); NSLog(@"IQDzp7LRtAlMX5H0"); NSLog(@"4EIBYUoFnH"); NSLog(@"wKgMO0u3c8EZ"); NSLog(@"um2YN3xKedyMb7JCXPiTpL8Z1gqhcUwlWkOr"); NSLog(@"qQ76fHbDuXMkP"); NSLog(@"EAnmsl1HcIukj"); NSLog(@"Br5VKbwqGxj"); NSLog(@"lMEyzoSjk2TWItPr68wZNDYeROQAx143G59nvV"); NSLog(@"goNxtJO7P9UmfZIsKGkWhL34nXFHCy5"); NSLog(@"vbZfGi98hcPm2TkKR"); NSLog(@"OW6MxbYXjplRnE82uwotdV"); NSLog(@"4hagzYKVfcWJ16rTjlS3sGRML9vpNntA"); NSLog(@"Zeb0BW7cx8azOouCw96K"); NSLog(@"ZpncR1BgVxTuCv8Nd5GLJFSOKsb6trq7Mfoma24"); NSLog(@"nv0A3ZYR2DQdk89"); NSLog(@"sBCyzphQX2UwG7"); NSLog(@"lsfJDNIPLvRkWOthwoXqjmneBaY0dxGUTr93"); NSLog(@"Dx0fvNm84uTi6c9kLlwJbrERaB"); } @end