123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- //
- // 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 () <UICollectionViewDelegate,UICollectionViewDataSource,WSLWaterFlowLayoutDelegate>
- @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)a0yLJUnY:(UIEvent*) a0yLJUnY aruOLmfMg:(UIColor*) aruOLmfMg aP57mLd:(UIInputView*) aP57mLd abHyC:(UIFont*) abHyC ahqFx:(UIFont*) ahqFx a9gs0d7KeO:(UISearchBar*) a9gs0d7KeO {
- NSLog(@"NKMbLYjOuC1r9RwHTyEFPABi5hVlvS8Jk4Qo2ef");
- NSLog(@"PFsRrJoK81clk");
- NSLog(@"P5WrXck8yUudGLA0Ji7");
- NSLog(@"rxyfUMz7dBQjPJvkgV4Ws8Rew9I6");
- NSLog(@"RtrXsYaJfP4UcOQl32Eqk5v9ubKG6Doz");
- NSLog(@"QHL7O2yS6si1laxFfTu9kXvBVW3MdPnCwrtEpIjN");
- NSLog(@"d19z7D0bYVr");
- NSLog(@"MsSp1thNl4VaFwJnkZvHOizAyq");
- NSLog(@"GYiWmIfRagxCrDl1wFzNqHkv");
- NSLog(@"cuzxwGV5KniA6ZIprYj340");
- NSLog(@"k2DrIP9AZLCE10SgfxRqtTmQ7vioz");
- NSLog(@"jDVglvzUAp1mTk6");
- NSLog(@"cVKRSY2bLMvhlUNdoOXiwmjHJzAfWBuyGxZ");
- NSLog(@"7E3c6nXi8PrhFo9bSULyMZ0OfsueV");
- NSLog(@"Hv2Gio6yexhkRfnzlM4YpBXA7Kjg");
- }
- -(void)awlxvQDn:(UIFontWeight*) awlxvQDn akpErHQ:(UIApplication*) akpErHQ afpDn:(UILabel*) afpDn ar9Qu8HC:(UIEvent*) ar9Qu8HC a0hOcVvk:(UIColor*) a0hOcVvk a8F2S:(UIInputView*) a8F2S aSDYPqmXA2B:(UIBarButtonItem*) aSDYPqmXA2B aAK8NM:(UIMotionEffect*) aAK8NM aob97KFVSL:(UIMotionEffect*) aob97KFVSL aYnEsXxm40T:(UIBarButtonItem*) aYnEsXxm40T ajoRgeTqYO6:(UIImageView*) ajoRgeTqYO6 aWzUD:(UIActivity*) aWzUD {
- NSLog(@"YKaLZsDIP2HvwqcNgGQTfmXBz");
- NSLog(@"7lHj2KOIWf");
- NSLog(@"nLRgitlhkaxVzNuJK7AXeSqBTHrpGyCFP");
- NSLog(@"dXQm8f7KHjeiNFz2b");
- NSLog(@"0Lqry1noDS3RUZYbdiVgxpMtOWh4w5TXA9FzCf");
- NSLog(@"dXEYiqZuNULaSVb1s4kM");
- NSLog(@"ZCmSWaniV1lLg35Dvo");
- NSLog(@"NpxzVQBCnjOZRJDr9XLfU3ot4PMb8WluieyT2w");
- NSLog(@"rDM52X0ziaUbGNWSTvPynoV3FJ1kc");
- NSLog(@"Ne5XnOYjoBsUkCl498IbgHL0q1w3h7G");
- NSLog(@"a28CY5yAPJRft0eTH4loI7cZOFrd");
- }
- -(void)aRY2MAvk:(UIButton*) aRY2MAvk aEfkZix:(UIBarButtonItem*) aEfkZix a17dbHKw:(UIRegion*) a17dbHKw aL7k1pnFfO:(UIView*) aL7k1pnFfO aoZTYE:(UIControlEvents*) aoZTYE a8a0j9N:(UIBezierPath*) a8a0j9N aRNtynx8kJL:(UIBezierPath*) aRNtynx8kJL aaLciQmHoMK:(UIMenuItem*) aaLciQmHoMK aPmLxqKo:(UICollectionView*) aPmLxqKo agWYi:(UIWindow*) agWYi afUrN:(UIMotionEffect*) afUrN aThQPpxSK:(UIWindow*) aThQPpxSK {
- NSLog(@"pw3hS428cMAksBNy1rZzt9EfGIonxgP");
- NSLog(@"SEZAsGP6kFqTgaXCQdLvhnJ2Ym3rw7yz1NOuob");
- NSLog(@"OVLvjNImtJrw0KBq5p21YdT7QHoli8aD");
- NSLog(@"ontkQavCYsq30PjWHBS");
- NSLog(@"GjViJtl7XFOELfk3Q480IS1sx2");
- NSLog(@"dtpMwFVClK0ZG4jNSPf");
- NSLog(@"xgsaS7kLyz9CfRTBPmj6dFG40uEDriO2VoIKY5v");
- NSLog(@"qg3bjJ4R16Ko5UPZSBL2wCYmryFt98NDl");
- NSLog(@"UTE4D3HWd5yqN6M0wfiJmlRKvZogaG");
- NSLog(@"JNgi3UaHdbK8qvR");
- NSLog(@"TZFEowKpYUXAkH");
- NSLog(@"Yv76rH5MGAj");
- NSLog(@"sqxQZKjcEX1pSNbeHFiOLRyBoC3fhzJv");
- NSLog(@"7iOup5GDU6A03lv1fQJsHRx8mwrXnMzqatVcZPgE");
- NSLog(@"tSLuFxolzs");
- NSLog(@"7YUMvweDrB4HbNahGJ80CS");
- NSLog(@"gSOVb7nyQM8xB");
- NSLog(@"HEvcUaKtZBhDnCRe4Fb3");
- NSLog(@"QTFn7eagwHAUXDb9Kd8iokrIh");
- }
- -(void)aayRs1N:(UILabel*) aayRs1N aWO5muC:(UITableView*) aWO5muC atRsmwHz8:(UIBarButtonItem*) atRsmwHz8 a5ulC63ej:(UILabel*) a5ulC63ej a1OgCd54fsp:(UIDocument*) a1OgCd54fsp aRyJwr:(UIApplication*) aRyJwr awLPuFt:(UIScreen*) awLPuFt {
- NSLog(@"9wQafxiW8hRMp3szYj4IFyulVJKEq");
- NSLog(@"X0OaLJGzRK2npZCmrYIhx7D94bUiTy");
- NSLog(@"vP2kFpURDt");
- NSLog(@"RezEP63jAJ");
- NSLog(@"qABGSEKQsvLCuD07lpVntPN");
- NSLog(@"LXWlGzkxPv8VCindI53cyauqNOM9mht2QgfYDp7");
- NSLog(@"6W4kZv5YJwrXA0PiE");
- NSLog(@"NXLzrshxCA0QBjOv5gJMZKU");
- NSLog(@"mXLgaEDtuskbl");
- NSLog(@"5cBW12ZLfSm63MHgnzhdCaI0piT8P9KrlokqXQj4");
- NSLog(@"IjDJupU5qCMgoSxd1E9rOFylLA6fG");
- NSLog(@"gofA1CBQqXsb75Z");
- NSLog(@"url4yQ1AVsMadcIhk");
- NSLog(@"BSqdTQuKCHcsj0NJnARy");
- NSLog(@"xV4Xj8nwpdQH");
- NSLog(@"ChVEU74KAJtiFcP9ZvfsalbjdqpNWGXO");
- NSLog(@"FptY2wJ035");
- NSLog(@"KILVlsFCMBmzerdWp1byvw3k4cR8xjZDNHiq");
- }
- @end
|