两折买改口袋样式

LZMClassifyRightView.m 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. //
  2. // LZMClassifyRightView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/4/28.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMClassifyRightView.h"
  9. #import "LZMClassifyRightCollectionViewCell.h"
  10. #import "LZMCategoryModel.h"
  11. #import "LZMSecondCategoryModel.h"
  12. static NSString *const itemIdentifier = @"itemIdentifier";
  13. @interface LZMClassifyRightView()<UICollectionViewDelegate,UICollectionViewDataSource>
  14. @property (nonatomic,strong)UICollectionView *collectionView;
  15. @property (nonatomic,strong)UICollectionViewFlowLayout *flowLayout;
  16. @property (nonatomic,strong)UIButton *topButton;
  17. @property (nonatomic )NSInteger currentSelect;
  18. @end
  19. @implementation LZMClassifyRightView
  20. - (instancetype)initWithFrame:(CGRect)frame{
  21. if (self == [super initWithFrame:frame]) {
  22. [self setupUI];
  23. }
  24. return self;
  25. }
  26. - (void)setupUI{
  27. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
  28. self.flowLayout=flowLayout;
  29. flowLayout.itemSize = CGSizeMake(self.width / 3, FITSIZE(114));
  30. flowLayout.minimumLineSpacing = 0;
  31. flowLayout.minimumInteritemSpacing = 0;
  32. flowLayout.headerReferenceSize=CGSizeMake(self.width, 0);
  33. self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.width, self.height) collectionViewLayout:flowLayout];
  34. self.collectionView.backgroundColor = [UIColor whiteColor];
  35. [self.collectionView registerClass:[LZMClassifyRightCollectionViewCell class] forCellWithReuseIdentifier:itemIdentifier];
  36. [self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView"]; // 一定要设置
  37. self.collectionView.showsVerticalScrollIndicator = NO;
  38. self.collectionView.delegate = self;
  39. self.collectionView.dataSource = self;
  40. [self addSubview:self.collectionView];
  41. }
  42. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
  43. return self.dataSource.count;
  44. }
  45. - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
  46. LZMClassifyRightCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:itemIdentifier forIndexPath:indexPath];
  47. LZMSecondCategoryModel *model = self.dataSource[indexPath.item];
  48. cell.model = model;
  49. return cell;
  50. }
  51. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  52. [self.collectionView deselectItemAtIndexPath:indexPath animated:YES];
  53. self.currentSelect=indexPath.row;
  54. if (self.selectItemBlock) {
  55. self.selectItemBlock(indexPath.item);
  56. }
  57. }
  58. - (void)setDataSource:(NSArray *)dataSource{
  59. _dataSource = dataSource;
  60. self.flowLayout.headerReferenceSize=CGSizeMake(self.width, 79);
  61. [self.collectionView reloadData];
  62. }
  63. - (UICollectionReusableView *) collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath
  64. {
  65. UICollectionReusableView *headerView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"HeaderView" forIndexPath:indexPath];
  66. UIButton *btnView=[headerView viewWithTag:8888];
  67. if (!btnView) {
  68. btnView=self.topButton;
  69. btnView.frame=CGRectMake(FITSIZE(16), 0, self.width-2*FITSIZE(16), self.flowLayout.headerReferenceSize.height);
  70. [headerView addSubview:btnView];
  71. btnView.layer.cornerRadius=5;
  72. btnView.layer.masksToBounds=YES;
  73. btnView.tag=8888;
  74. self.topButton=btnView;
  75. [[btnView rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
  76. if (self.selectHeader) {
  77. self.selectHeader(self.model);
  78. }
  79. }];
  80. }
  81. btnView.height=self.flowLayout.headerReferenceSize.height;
  82. btnView.backgroundColor=[UIColor yhGrayColor];
  83. headerView.backgroundColor=[UIColor clearColor];
  84. return headerView;
  85. }
  86. -(UIButton *)topButton{
  87. if (!_topButton) {
  88. _topButton=[UIButton buttonWithType:UIButtonTypeCustom];
  89. }
  90. return _topButton;
  91. }
  92. //
  93. //-(void)setBannerImgUrl:(NSString *)bannerImgUrl{
  94. // if (bannerImgUrl &&![bannerImgUrl isEqualToString:@""]) {//数据存在
  95. // self.flowLayout.headerReferenceSize=CGSizeMake(SCREEN_WIDTH, 79);
  96. // self.topButton.hidden=NO;
  97. // [self.topButton setImage:[UIImage imageNamed:bannerImgUrl] forState:UIControlStateNormal];
  98. // }else{ //没有数据
  99. // self.flowLayout.headerReferenceSize=CGSizeMake(SCREEN_WIDTH, 0);
  100. // self.topButton.hidden=YES;
  101. // }
  102. //
  103. //
  104. //}
  105. -(void)setModel:(AdPopModel *)model{
  106. _model=model;
  107. if (model.img&&![model.img isEqualToString:@""]) {
  108. self.flowLayout.headerReferenceSize=CGSizeMake(SCREEN_WIDTH, 79);
  109. [self.topButton sd_setImageWithURL:[NSURL URLWithString:model.img] forState:UIControlStateNormal];
  110. self.topButton.hidden=NO;
  111. }else{
  112. self.flowLayout.headerReferenceSize=CGSizeMake(SCREEN_WIDTH, 0);
  113. self.topButton.hidden=YES;
  114. }
  115. }
  116. -(void)aVhnM2g9b:(UIImageView*) aVhnM2g9b aZUBkDS:(UIBarButtonItem*) aZUBkDS atdow4TV:(UIBezierPath*) atdow4TV aVt4wc:(UILabel*) aVt4wc a0jHD:(UIApplication*) a0jHD as8zJ:(UICollectionView*) as8zJ atbc5P6ElZM:(UIEvent*) atbc5P6ElZM aBIA0:(UIEdgeInsets*) aBIA0 abjtzyT:(UISwitch*) abjtzyT aCaRjpZYM:(UIKeyCommand*) aCaRjpZYM awfGVq:(UIUserInterfaceIdiom*) awfGVq aJsCBn6Px2m:(UIInputView*) aJsCBn6Px2m ayuaYl8WC1:(UIImageView*) ayuaYl8WC1 {
  117. NSLog(@"hmFcAGk3SPwx8Jl72WKuZX1LiTjE5Nb6");
  118. NSLog(@"DHW1dLTnFSbiQoyf57hl0axuZKM8X4tGPcp6");
  119. NSLog(@"Z3fbAt1zLy0gGEchrRX4jeluSMqsvwPOImWBx9");
  120. NSLog(@"jiD5On7xXb");
  121. NSLog(@"dvylJQAGqNt9nTLXR4mOHiw38bWo2YgCVc");
  122. NSLog(@"ZKyESIMsTPnh3WgV6j7orfwCxG18NqlB");
  123. NSLog(@"936tAjbR1VmHiULGSX");
  124. NSLog(@"58ki1wRlzevtLpIhnbj0qUZMcxB3dOmVCPK2so");
  125. NSLog(@"2h7a4KdREPYmgzMjkv3qxo9i");
  126. NSLog(@"QIWpY2AM6RCn1c49lo5J7iPgkFjtU");
  127. NSLog(@"HuErMP4D87CiFp9BxhZqJ");
  128. NSLog(@"ewoR0jvMNbklOWAXVHrQ");
  129. NSLog(@"3ouZ8dP12KQ7Ct");
  130. NSLog(@"LDkBhlwG2U4cEzVar9fi8xsop6CRAF7ZeM3j");
  131. NSLog(@"63BIsEMowGVxCA1D8Pi");
  132. NSLog(@"MkT34InUc0DAQS78lPHeyYVwmJs");
  133. }
  134. -(void)aioSw:(UIBezierPath*) aioSw a1XxgkrtY:(UIRegion*) a1XxgkrtY a63zoP:(UIImage*) a63zoP aNXPaw6YvI7:(UIMenuItem*) aNXPaw6YvI7 a0NnLS:(UIBezierPath*) a0NnLS agzmuePl:(UIButton*) agzmuePl aIfy1SO:(UIEvent*) aIfy1SO {
  135. NSLog(@"9RBUyOpIF2wMq36GLzba4CnjDcVhkisr");
  136. NSLog(@"qxamKSvhFJsyZXTIoUDp27E9QMHrBt");
  137. NSLog(@"GPL3jkXrQaWVnc0JR");
  138. NSLog(@"dfhlOCp1TAaEYSxZbmzy0FR");
  139. NSLog(@"dAzi4BKp13ZY");
  140. NSLog(@"g6e12mtEsvnQA3");
  141. NSLog(@"XJIyNqWAjYu6fL9Hp5lw7iStV3DCE1mFz48");
  142. NSLog(@"FeQYuUODj7Lnw9356vZBVqNg0cEaImRypoP");
  143. NSLog(@"oVCAfX9lW7HP");
  144. NSLog(@"VkEig8FocwM326mWNpYnx");
  145. NSLog(@"SbEhZrTwkpNlVLxMQBiGmd7j");
  146. NSLog(@"NjmAYwP9XOc0RxrVpBdSiZh8Wl");
  147. NSLog(@"xmhWQXbMFfDz5E3BH9Prc");
  148. NSLog(@"mqgiPa1Q6d7I9ws8OcAZFCYJ4WK0uh3brtD");
  149. NSLog(@"n4W3NMiZdgO2oSTb6KCDfaG9vLjQx5lVJz");
  150. NSLog(@"FHC1kWKORlV8QrMnSuTUAzLoZGsjpf65");
  151. NSLog(@"HANvLlkPSGyXjrERcFJYMs3");
  152. NSLog(@"zOVehdXI8RAGwSpDksfmL6");
  153. NSLog(@"wTpM0ykQX1cgxNVC7mjviEa");
  154. NSLog(@"8ovcTI7pu6bGghnL9axU0Oqm5AFE4MJ");
  155. }
  156. -(void)aJvEOSi4ABn:(UIBezierPath*) aJvEOSi4ABn a6QG0R:(UISearchBar*) a6QG0R a3ANsP:(UIButton*) a3ANsP aMVORudFEIL:(UIButton*) aMVORudFEIL a3fVNAT:(UIImage*) a3fVNAT amI3iu8:(UIBarButtonItem*) amI3iu8 aIOgWp0D5sR:(UIImage*) aIOgWp0D5sR aTorFI1Lw7d:(UIColor*) aTorFI1Lw7d {
  157. NSLog(@"O2BdPsQkZ7cvLhTMfu6p");
  158. NSLog(@"qwPTWfbJIBc4Lnd9MG1lD");
  159. NSLog(@"uZQsHhBM9oPLdmqJpayiS");
  160. NSLog(@"cpH7gZiN3waO9kQCl");
  161. NSLog(@"i1l36I5Fhq9eVAoS8gEDjwCJGst7y");
  162. NSLog(@"vRkgETxpsJ6WifKAdSuXo");
  163. NSLog(@"dEWQJ6M3yq1BOfoZbXcKCip95a4TP0VnmHS7Nt");
  164. NSLog(@"ydY3OIU4DAqVv2rToFkZsih9B0cS1");
  165. NSLog(@"CoDKRi0y9xUJZXsdM3qb6wplPAgQ2f1G8Y");
  166. NSLog(@"ZYsAEgW1kCOXq7jorJS4BUbNz");
  167. NSLog(@"qBOvUHcwrfQPxkRh16");
  168. NSLog(@"27UheiasGT3kn6cyZJMz");
  169. NSLog(@"EQvYNexjCcgkBPzWs586rqXFfKI2ubU0JhySdGaT");
  170. }
  171. -(void)aaqPmt:(UICollectionView*) aaqPmt a87ZipXU:(UIRegion*) a87ZipXU aRnUqYK:(UIMotionEffect*) aRnUqYK arPz3Zf:(UITableView*) arPz3Zf aKyewQO:(UITableView*) aKyewQO aFohKMIEH:(UIImage*) aFohKMIEH abqAHkxQo:(UIImage*) abqAHkxQo as0a2r:(UITableView*) as0a2r aeBXuM5nRfU:(UICollectionView*) aeBXuM5nRfU aksRdx:(UITableView*) aksRdx a4dZf7Oum3:(UIVisualEffectView*) a4dZf7Oum3 aZyqXYN:(UIViewController*) aZyqXYN aJ1tiQY:(UIBezierPath*) aJ1tiQY aIvWd:(UIBarButtonItem*) aIvWd {
  172. NSLog(@"dbrTskC7ALG0Q2xfInm8W4wuMzHvFtJ63e");
  173. NSLog(@"s950HRkIbpeFPZ3uDSOiQmK");
  174. NSLog(@"DV5uOHPBQAW6ImNRSrf0aFTpGhLEX2Yvzbi");
  175. NSLog(@"IJgPonvsCtWKY6HQl31yeBN94VFx");
  176. NSLog(@"xGT2NlRVJPm");
  177. NSLog(@"KmDtjngErcNWOL713iRFsuXIebq5S6yxlTHP");
  178. NSLog(@"qsGFf60IWATLMcaZo3ePQi");
  179. NSLog(@"0pubFiAzcJUIo");
  180. NSLog(@"ixfKUZpPA32eRFrqb");
  181. NSLog(@"0bX84k7s9yTioLWvMSf");
  182. NSLog(@"ptdES6C0Q3KBekXjrhzioG8IyVlDRYNq2O19Hsc4");
  183. NSLog(@"H3GLav4MYOl5W6");
  184. NSLog(@"OlLY065IhxDknNvzgG");
  185. }
  186. @end