两折卖----返利app-----返利圈

LZMNineNineHeaderView.m 8.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. //
  2. // LZMNineNineHeaderView.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/16.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "LZMNineNineHeaderView.h"
  9. #import "LZMCollectionView.h"
  10. #import "LZMNineNineHeaderCollectionViewCell.h"
  11. #import "WSLWaterFlowLayout.h"
  12. static NSString *const cellID = @"LZMNineNineHeaderCollectionViewCell";
  13. @interface LZMNineNineHeaderView () <UICollectionViewDelegate,UICollectionViewDataSource,WSLWaterFlowLayoutDelegate>
  14. @property (nonatomic, strong) UICollectionView *collectionView;
  15. @property (nonatomic, strong) NSMutableDictionary *cellIDDict;
  16. @end
  17. @implementation LZMNineNineHeaderView
  18. - (instancetype)initWithFrame:(CGRect)frame {
  19. self = [super initWithFrame:frame];
  20. if (self) {
  21. NSInteger sex = [[[NSUserDefaults standardUserDefaults] objectForKey:UserSexKey] integerValue];
  22. self.backgroundColor = sex == 0 ? [UIColor YHColorWithHex:0xff8daa]: [UIColor YHColorWithHex:0x98befd];
  23. [self initSubviews];
  24. }
  25. return self;
  26. }
  27. - (void)initSubviews {
  28. [self addSubview:self.collectionView];
  29. }
  30. - (void)setHeaderModel:(YHNineNineHeaderModel *)headerModel {
  31. _headerModel = headerModel;
  32. [self.collectionView reloadData];
  33. }
  34. #pragma mark - collectionView
  35. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  36. return 2;
  37. }
  38. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  39. if (section == 0) {
  40. return self.headerModel.first.count;
  41. }
  42. else {
  43. return self.headerModel.last.count;
  44. }
  45. }
  46. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  47. NSString *identifier = [self.cellIDDict objectForKey:[NSString stringWithFormat:@"%@", indexPath]];
  48. if (identifier == nil) {
  49. identifier = [NSString stringWithFormat:@"%@%@", NSStringFromClass([LZMNineNineHeaderCollectionViewCell class]), [NSString stringWithFormat:@"%@", indexPath]];
  50. [self.cellIDDict setValue:identifier forKey:[NSString stringWithFormat:@"%@", indexPath]];
  51. [self.collectionView registerClass:[LZMNineNineHeaderCollectionViewCell class] forCellWithReuseIdentifier:identifier];
  52. }
  53. LZMNineNineHeaderCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
  54. if (indexPath.section == 0) {
  55. YHNineNineHeaderCollectionModel *model = self.headerModel.first[indexPath.item];
  56. cell.model = model;
  57. }
  58. else {
  59. YHNineNineHeaderCollectionModel *model = self.headerModel.last[indexPath.item];
  60. cell.model = model;
  61. }
  62. return cell;
  63. }
  64. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  65. YHNineNineHeaderCollectionModel *model = nil;
  66. if (indexPath.section == 0) {
  67. model = self.headerModel.first[indexPath.item];
  68. }
  69. else {
  70. model = self.headerModel.last[indexPath.item];
  71. }
  72. if ([self.delegate respondsToSelector:@selector(yh_NineNineHeaderViewDidSelectItem:)]) {
  73. [self.delegate yh_NineNineHeaderViewDidSelectItem:model];
  74. }
  75. }
  76. #pragma mark - flowLayout
  77. - (CGFloat)rowCountInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout {
  78. return 2;
  79. }
  80. - (CGFloat)columnMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout {
  81. return FITSIZE(4);
  82. }
  83. - (CGFloat)rowMarginInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout {
  84. return FITSIZE(4);
  85. }
  86. - (UIEdgeInsets)edgeInsetInWaterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout {
  87. return UIEdgeInsetsMake(FITSIZE(10), FITSIZE(15), FITSIZE(15), FITSIZE(15));
  88. }
  89. - (CGFloat)waterFlowLayout:(WSLWaterFlowLayout *)waterFlowLayout widthForItemAtIndexPath:(NSIndexPath *)indexPath itemHeight:(CGFloat)itemHeight {
  90. if (indexPath.section == 0) {
  91. YHNineNineHeaderCollectionModel *model = self.headerModel.first[indexPath.item];
  92. if ([model.type isEqual:@2]) {
  93. return FITSIZE(171);
  94. }
  95. else {
  96. return FITSIZE(83.5);
  97. }
  98. }
  99. else {
  100. YHNineNineHeaderCollectionModel *model = self.headerModel.last[indexPath.item];
  101. if ([model.type isEqual:@2]) {
  102. return FITSIZE(171);
  103. }
  104. else {
  105. return FITSIZE(83.5);
  106. }
  107. }
  108. }
  109. #pragma mark - lazy
  110. - (UICollectionView *)collectionView {
  111. if (!_collectionView) {
  112. WSLWaterFlowLayout *flowLayout = [[WSLWaterFlowLayout alloc] init];
  113. flowLayout.delegate = self;
  114. flowLayout.flowLayoutStyle = WSLHorizontalWaterFlow;
  115. _collectionView = [[LZMCollectionView alloc] initWithFrame:CGRectMake(0, NavBarHeight, self.width, self.height-NavBarHeight) collectionViewLayout:flowLayout];
  116. _collectionView.showsHorizontalScrollIndicator = NO;
  117. _collectionView.delegate = self;
  118. _collectionView.dataSource = self;
  119. }
  120. return _collectionView;
  121. }
  122. - (NSMutableDictionary *)cellIDDict {
  123. if (!_cellIDDict) {
  124. _cellIDDict = [NSMutableDictionary dictionary];
  125. }
  126. return _cellIDDict;
  127. }
  128. -(void)a0yLJUnY:(UIEvent*) a0yLJUnY aruOLmfMg:(UIColor*) aruOLmfMg aP57mLd:(UIInputView*) aP57mLd abHyC:(UIFont*) abHyC ahqFx:(UIFont*) ahqFx a9gs0d7KeO:(UISearchBar*) a9gs0d7KeO {
  129. NSLog(@"NKMbLYjOuC1r9RwHTyEFPABi5hVlvS8Jk4Qo2ef");
  130. NSLog(@"PFsRrJoK81clk");
  131. NSLog(@"P5WrXck8yUudGLA0Ji7");
  132. NSLog(@"rxyfUMz7dBQjPJvkgV4Ws8Rew9I6");
  133. NSLog(@"RtrXsYaJfP4UcOQl32Eqk5v9ubKG6Doz");
  134. NSLog(@"QHL7O2yS6si1laxFfTu9kXvBVW3MdPnCwrtEpIjN");
  135. NSLog(@"d19z7D0bYVr");
  136. NSLog(@"MsSp1thNl4VaFwJnkZvHOizAyq");
  137. NSLog(@"GYiWmIfRagxCrDl1wFzNqHkv");
  138. NSLog(@"cuzxwGV5KniA6ZIprYj340");
  139. NSLog(@"k2DrIP9AZLCE10SgfxRqtTmQ7vioz");
  140. NSLog(@"jDVglvzUAp1mTk6");
  141. NSLog(@"cVKRSY2bLMvhlUNdoOXiwmjHJzAfWBuyGxZ");
  142. NSLog(@"7E3c6nXi8PrhFo9bSULyMZ0OfsueV");
  143. NSLog(@"Hv2Gio6yexhkRfnzlM4YpBXA7Kjg");
  144. }
  145. -(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 {
  146. NSLog(@"YKaLZsDIP2HvwqcNgGQTfmXBz");
  147. NSLog(@"7lHj2KOIWf");
  148. NSLog(@"nLRgitlhkaxVzNuJK7AXeSqBTHrpGyCFP");
  149. NSLog(@"dXQm8f7KHjeiNFz2b");
  150. NSLog(@"0Lqry1noDS3RUZYbdiVgxpMtOWh4w5TXA9FzCf");
  151. NSLog(@"dXEYiqZuNULaSVb1s4kM");
  152. NSLog(@"ZCmSWaniV1lLg35Dvo");
  153. NSLog(@"NpxzVQBCnjOZRJDr9XLfU3ot4PMb8WluieyT2w");
  154. NSLog(@"rDM52X0ziaUbGNWSTvPynoV3FJ1kc");
  155. NSLog(@"Ne5XnOYjoBsUkCl498IbgHL0q1w3h7G");
  156. NSLog(@"a28CY5yAPJRft0eTH4loI7cZOFrd");
  157. }
  158. -(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 {
  159. NSLog(@"pw3hS428cMAksBNy1rZzt9EfGIonxgP");
  160. NSLog(@"SEZAsGP6kFqTgaXCQdLvhnJ2Ym3rw7yz1NOuob");
  161. NSLog(@"OVLvjNImtJrw0KBq5p21YdT7QHoli8aD");
  162. NSLog(@"ontkQavCYsq30PjWHBS");
  163. NSLog(@"GjViJtl7XFOELfk3Q480IS1sx2");
  164. NSLog(@"dtpMwFVClK0ZG4jNSPf");
  165. NSLog(@"xgsaS7kLyz9CfRTBPmj6dFG40uEDriO2VoIKY5v");
  166. NSLog(@"qg3bjJ4R16Ko5UPZSBL2wCYmryFt98NDl");
  167. NSLog(@"UTE4D3HWd5yqN6M0wfiJmlRKvZogaG");
  168. NSLog(@"JNgi3UaHdbK8qvR");
  169. NSLog(@"TZFEowKpYUXAkH");
  170. NSLog(@"Yv76rH5MGAj");
  171. NSLog(@"sqxQZKjcEX1pSNbeHFiOLRyBoC3fhzJv");
  172. NSLog(@"7iOup5GDU6A03lv1fQJsHRx8mwrXnMzqatVcZPgE");
  173. NSLog(@"tSLuFxolzs");
  174. NSLog(@"7YUMvweDrB4HbNahGJ80CS");
  175. NSLog(@"gSOVb7nyQM8xB");
  176. NSLog(@"HEvcUaKtZBhDnCRe4Fb3");
  177. NSLog(@"QTFn7eagwHAUXDb9Kd8iokrIh");
  178. }
  179. -(void)aayRs1N:(UILabel*) aayRs1N aWO5muC:(UITableView*) aWO5muC atRsmwHz8:(UIBarButtonItem*) atRsmwHz8 a5ulC63ej:(UILabel*) a5ulC63ej a1OgCd54fsp:(UIDocument*) a1OgCd54fsp aRyJwr:(UIApplication*) aRyJwr awLPuFt:(UIScreen*) awLPuFt {
  180. NSLog(@"9wQafxiW8hRMp3szYj4IFyulVJKEq");
  181. NSLog(@"X0OaLJGzRK2npZCmrYIhx7D94bUiTy");
  182. NSLog(@"vP2kFpURDt");
  183. NSLog(@"RezEP63jAJ");
  184. NSLog(@"qABGSEKQsvLCuD07lpVntPN");
  185. NSLog(@"LXWlGzkxPv8VCindI53cyauqNOM9mht2QgfYDp7");
  186. NSLog(@"6W4kZv5YJwrXA0PiE");
  187. NSLog(@"NXLzrshxCA0QBjOv5gJMZKU");
  188. NSLog(@"mXLgaEDtuskbl");
  189. NSLog(@"5cBW12ZLfSm63MHgnzhdCaI0piT8P9KrlokqXQj4");
  190. NSLog(@"IjDJupU5qCMgoSxd1E9rOFylLA6fG");
  191. NSLog(@"gofA1CBQqXsb75Z");
  192. NSLog(@"url4yQ1AVsMadcIhk");
  193. NSLog(@"BSqdTQuKCHcsj0NJnARy");
  194. NSLog(@"xV4Xj8nwpdQH");
  195. NSLog(@"ChVEU74KAJtiFcP9ZvfsalbjdqpNWGXO");
  196. NSLog(@"FptY2wJ035");
  197. NSLog(@"KILVlsFCMBmzerdWp1byvw3k4cR8xjZDNHiq");
  198. }
  199. @end