一折买app------返利---------返利宝

YZMANineNineScrollChildViewController.m 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. //
  2. // YZMANineNineScrollChildViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/1/29.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "YZMANineNineScrollChildViewController.h"
  9. #import "YZMACollectionView.h"
  10. #import "YZMAScrollChildCollectionViewCell.h"
  11. #import "YZMANineNineScrollChannelModel.h"
  12. #import "YZMANineNineRequestViewModel.h"
  13. #import "YZMAGoodCollectionCell.h"
  14. #import "YZMACollectionView.h"
  15. #import "YZMANineCollectionView.h"
  16. static NSString *const cellID = @"YZMAScrollChildCollectionViewCell";
  17. static NSInteger page = 1;
  18. @interface YZMANineNineScrollChildViewController () <UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
  19. @property (nonatomic, strong) NSMutableArray *dataSource;
  20. @property (nonatomic, strong) UIButton *toTopButton;
  21. @end
  22. @implementation YZMANineNineScrollChildViewController
  23. - (void)viewDidLoad {
  24. [super viewDidLoad];
  25. [self initNavBar];
  26. [self initSubviews];
  27. [self request];
  28. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changedSexRequest) name:ChangeSex object:nil];
  29. }
  30. - (void)didReceiveMemoryWarning {
  31. [super didReceiveMemoryWarning];
  32. }
  33. - (void)initNavBar {
  34. self.navigationBar.hidden = YES;
  35. }
  36. - (void)initSubviews {
  37. [self.view addSubview:self.collectionView];
  38. UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-50, self.collectionView.height-100, 40, 40)];
  39. button.backgroundColor = [UIColor grayColor];
  40. button.layer.cornerRadius = 20;
  41. [self.view addSubview:button];
  42. [button addTarget:self action:@selector(scrollToTopAction) forControlEvents:UIControlEventTouchUpInside];
  43. [button setTitle:@"回顶部" forState:UIControlStateNormal];
  44. button.titleLabel.font = [UIFont systemFontOfSize:12];
  45. self.toTopButton = button;
  46. self.toTopButton.alpha = .0;
  47. }
  48. - (void)scrollToTopAction {
  49. [self.collectionView scrollToTop];
  50. }
  51. #pragma mark - request
  52. - (void)request {
  53. [YZMANineNineRequestViewModel requestNineNineCategoryGoodsParamPage:page scid:self.model.Id type:@"1" stype:@"1" success:^(NSArray *array) {
  54. if (array.count > 0) {
  55. [self.dataSource addObjectsFromArray:array];
  56. [self.collectionView reloadData];
  57. }
  58. [self.collectionView.mj_footer endRefreshing];
  59. } failure:^(NSError *error) {
  60. [self.collectionView.mj_footer endRefreshing];
  61. }];
  62. }
  63. - (void)changedSexRequest {
  64. [self.dataSource removeAllObjects];
  65. page = 1;
  66. [self request];
  67. }
  68. #pragma mark - collectionview
  69. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  70. return 1;
  71. }
  72. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  73. return self.dataSource.count;
  74. }
  75. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  76. YZMAScrollChildCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  77. cell.backgroundColor = [UIColor whiteColor];
  78. cell.backgroundView.backgroundColor = [UIColor whiteColor];
  79. cell.contentView.backgroundColor = [UIColor whiteColor];
  80. YZMAChildGoodModel *model = self.dataSource[indexPath.item];
  81. cell.model = model;
  82. return cell;
  83. }
  84. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
  85. return CGSizeZero;
  86. }
  87. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  88. if ([self.delegate respondsToSelector:@selector(yh_NineNineScrollChildViewControllerDidSelectItem:)]) {
  89. YZMAChildGoodModel *model = self.dataSource[indexPath.item];
  90. [self.delegate yh_NineNineScrollChildViewControllerDidSelectItem:model];
  91. }
  92. }
  93. - (void)setCanScroll:(BOOL)canScroll {
  94. _canScroll = canScroll;
  95. self.collectionView.canScroll = canScroll;
  96. }
  97. #pragma mark - scrollView
  98. - (void)scrollViewDidScroll:(UIScrollView *)scrollView
  99. {
  100. if (!self.canScroll) {
  101. scrollView.contentOffset = CGPointZero;
  102. }
  103. if (scrollView.contentOffset.y <= 0) {
  104. // if (!self.fingerIsTouch) {//这里的作用是在手指离开屏幕后也不让显示主视图,具体可以自己看看效果
  105. // return;
  106. // }
  107. self.canScroll = NO;
  108. scrollView.contentOffset = CGPointZero;
  109. [[NSNotificationCenter defaultCenter] postNotificationName:@"leaveTop" object:nil];//到顶通知父视图改变状态
  110. }
  111. [self setScrollToTopView:scrollView changeHeight:SCREEN_HEIGHT];
  112. }
  113. - (void)setScrollToTopView:(UIScrollView *)scrollView changeHeight:(CGFloat)height{
  114. CGFloat offY = scrollView.contentOffset.y;
  115. if (offY >= height-1) {
  116. UIPanGestureRecognizer *pan = scrollView.panGestureRecognizer;
  117. //获取到拖拽的速度 >0 向下拖动 <0 向上拖动
  118. CGFloat velocity = [pan velocityInView:scrollView].y;
  119. if (velocity <- 10) {
  120. //向上拖动,隐藏
  121. [UIView animateWithDuration:0.35 animations:^{
  122. self.toTopButton.alpha = 0.0;
  123. }];
  124. }else if (velocity > 10) {
  125. //向下拖动,显示
  126. [UIView animateWithDuration:0.35 animations:^{
  127. self.toTopButton.alpha = 1.0;
  128. }];
  129. }else if(velocity == 0){
  130. //停止拖拽
  131. }
  132. }else {
  133. [UIView animateWithDuration:0.35 animations:^{
  134. self.toTopButton.alpha = 0.0;
  135. }];
  136. }
  137. }
  138. #pragma mark - lazy
  139. - (UICollectionView *)collectionView {
  140. if (!_collectionView) {
  141. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  142. flowLayout.itemSize = CGSizeMake(FITSIZE(184.9), FITSIZE(287));
  143. flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
  144. flowLayout.minimumLineSpacing = FITSIZE(5);
  145. flowLayout.minimumInteritemSpacing = FITSIZE(5);
  146. _collectionView = [[YZMANineCollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-NavBarHeight-FITSIZE(40)) collectionViewLayout:flowLayout];
  147. _collectionView.backgroundView.backgroundColor = [UIColor clearColor];
  148. _collectionView.backgroundColor = [UIColor clearColor];
  149. _collectionView.bounces = YES;
  150. _collectionView.delegate = self;
  151. _collectionView.dataSource = self;
  152. _collectionView.backgroundColor = [UIColor clearColor];
  153. [_collectionView registerClass:[YZMAScrollChildCollectionViewCell class] forCellWithReuseIdentifier:cellID];
  154. if (@available(iOS 11.0, *)) {
  155. _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  156. }
  157. kWeak(self);
  158. _collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  159. page ++;
  160. [selfWeak request];
  161. }];
  162. }
  163. return _collectionView;
  164. }
  165. - (NSMutableArray *)dataSource {
  166. if (!_dataSource) {
  167. _dataSource = [NSMutableArray array];
  168. }
  169. return _dataSource;
  170. }
  171. -(void)av0Dhj9xBl:(UIViewController*) av0Dhj9xBl aApWC:(UIUserInterfaceIdiom*) aApWC aEr7S6GqFP:(UIScreen*) aEr7S6GqFP a6o3jADCq7:(UISearchBar*) a6o3jADCq7 aLQ6e:(UIWindow*) aLQ6e aJUKWgn:(UIDevice*) aJUKWgn acZKwjbdit6:(UIImageView*) acZKwjbdit6 {
  172. NSLog(@"N0AsoBEqvbKVXfyPeD7YH8R3WMklgcx");
  173. NSLog(@"Tb4jEZFhxWnV9S7tOgmk3wfdUzBiC");
  174. NSLog(@"M9dV4xlGoDU2JHy");
  175. NSLog(@"ptzE5dFeqNZmXhowRKPyI");
  176. NSLog(@"z6rbVUoI1OjEk3lcdMNLwta45ipP2svy");
  177. NSLog(@"dowbtrjfPSY48qFxKBsU7");
  178. NSLog(@"Uid21GHJgzVt96");
  179. NSLog(@"087xBhkc3GFmNLQveRUdJ1uWw5X");
  180. NSLog(@"NteLz4WbQGRTmaHx7f6cpCIs1n0qYdlX");
  181. NSLog(@"ioe6G51kPCXwtT8aEZRSV");
  182. NSLog(@"P5zNusLKfBY2nm");
  183. NSLog(@"8VriLkbmSXEBWej93ofcqUM");
  184. NSLog(@"QFzkuVrnB74q3Pf5SLMx");
  185. NSLog(@"mtgrIxSpG7jEk39hqXCaz4cUZdALWsV");
  186. NSLog(@"uVtReWv3yiESkCOLm");
  187. NSLog(@"0qOmYuCaV4ARtzGsw6Md");
  188. NSLog(@"tIezomEhWjl8gFs2w");
  189. NSLog(@"EtlfsedxWj95");
  190. }
  191. -(void)aMmNVkbh1:(UIWindow*) aMmNVkbh1 aHyakw7q2Ql:(UIDevice*) aHyakw7q2Ql aoeF4:(UIActivity*) aoeF4 ayThxAz:(UIMenuItem*) ayThxAz a17hPoRSBLy:(UIRegion*) a17hPoRSBLy a3U6E0lYjCM:(UIImageView*) a3U6E0lYjCM a1ELO6xKi:(UIEdgeInsets*) a1ELO6xKi anw8b70taN4:(UIAlertView*) anw8b70taN4 avE8y:(UIColor*) avE8y ayq7OC8A2Ns:(UIBarButtonItem*) ayq7OC8A2Ns apE7qMZPBho:(UIDocument*) apE7qMZPBho aO68WzRDxfV:(UIColor*) aO68WzRDxfV a9Ak6WLncMX:(UIBarButtonItem*) a9Ak6WLncMX aXkMjNghb:(UIDevice*) aXkMjNghb az34Bj:(UIVisualEffectView*) az34Bj aPtVsj6JU:(UIVisualEffectView*) aPtVsj6JU an2aH30b:(UIAlertView*) an2aH30b {
  192. NSLog(@"GowvpihuWBYFLaVQ");
  193. NSLog(@"DrTSvNohCJj");
  194. NSLog(@"gOMn6D3BH9tPJYuW85SjvxVyfIpA");
  195. NSLog(@"Ot19KeDlUxNqiyodCRwJ");
  196. NSLog(@"pJoge5r4cY1i6QkvW8qymFxX0OD9VlLa");
  197. NSLog(@"ta1nVcquwALBxE9NKd8SpmCH0vZU6bG");
  198. NSLog(@"tJp9UO3eg4lXiqZCMW");
  199. NSLog(@"BqgkiXAYpM72J8D3vOT");
  200. NSLog(@"nlizMm2T3eurJUOZIF1KjqVhHY06gw8");
  201. NSLog(@"oVcnH4O1MdkZTNFXQpyDem2Wx8P");
  202. NSLog(@"H6Scr4tLdlPYmGqCyW");
  203. NSLog(@"YClzD8WniI719063sevUo");
  204. NSLog(@"Gx5AXwoL2SBOszZm9PU7pahqfVNgnYi");
  205. NSLog(@"edHxJThYQ4sWN1OX8BK9nowbv2aSirz");
  206. NSLog(@"HhyutkKF5UIa");
  207. NSLog(@"Z92dTDK4prSjzLY3Oe0Vsa");
  208. NSLog(@"cLnPshfyJWoCVg1a2qQj8TYrZGUk6MB9Ov7F");
  209. NSLog(@"53DBZjuwaWYQ4rO6z2bkMeldcRoHhVESfF");
  210. NSLog(@"mJIxaLdvQ5jyZbrknDpXA");
  211. }
  212. -(void)aPRdcho:(UIViewController*) aPRdcho acawjtYD:(UIBarButtonItem*) acawjtYD aQHgu:(UIBarButtonItem*) aQHgu axrCgFpu:(UIControlEvents*) axrCgFpu amJTFt:(UIBezierPath*) amJTFt afqn6LzpObe:(UIAlertView*) afqn6LzpObe a0Edb:(UIMenuItem*) a0Edb aYbVT:(UIKeyCommand*) aYbVT aRZvaF4ThOz:(UILabel*) aRZvaF4ThOz aWxEYz9:(UIKeyCommand*) aWxEYz9 aqCfOQoT74V:(UIBarButtonItem*) aqCfOQoT74V aUNnB:(UIRegion*) aUNnB awpM7e2iv:(UIViewController*) awpM7e2iv {
  213. NSLog(@"FgiZ6Vvb8UC7xr4k3lzDN");
  214. NSLog(@"LlTiIXwVexk8DOB1vsHnAgbzNQJcyom5");
  215. NSLog(@"V1Y9CdvHtDywMple0");
  216. NSLog(@"n4IvSHEORuz3WeoZDNrAlt");
  217. NSLog(@"YkpWfwaU58tE104TdGDCJKQmuP");
  218. NSLog(@"VQZTJv4UgNKwDM0O2rYIFo1bk5zjLWE8sSqhtlP");
  219. NSLog(@"bBo1ZIsx4XL6yFkUuVYKcahvrCP09d");
  220. NSLog(@"QocZaM6xdlnb2Twr9K7DR8VsNLyXmAWjEfqhi");
  221. NSLog(@"yYV1oOlbIEjM9iQSw4Zs56Kka2B03rFqzxnT");
  222. NSLog(@"BpdaigL3StvNTQKDl6FP");
  223. NSLog(@"d86mFr54hUbGMEZvRujoOeSLlQ7Vt");
  224. NSLog(@"2GSvu3ft1VWgcXUi5ICJ0Z");
  225. NSLog(@"fHZc3uglanIG2");
  226. NSLog(@"N2x8aXfktSyvwUrHzVcljMpTC1inA93GWYsd");
  227. NSLog(@"IHElaNvQUfiWO6oMj5PDgw");
  228. NSLog(@"ZTk6hXHQBqDKPbOgA8FUfjLyE7");
  229. NSLog(@"Z8nAu3sX6w5Smyx9b");
  230. NSLog(@"t1aiUfm9VcrKs3LAb");
  231. NSLog(@"nshtJ62Kf5e7cgTkRbovLj");
  232. NSLog(@"5cTk4mN78UfZnwv1iKDs");
  233. }
  234. -(void)aLEOWTKd:(UIInputView*) aLEOWTKd aNebf4:(UIScreen*) aNebf4 ackDAyR:(UIBarButtonItem*) ackDAyR acCXIQU:(UIView*) acCXIQU a13i9CEbJ:(UIKeyCommand*) a13i9CEbJ aRmCz8Qq:(UIMotionEffect*) aRmCz8Qq a7fJ6:(UIControlEvents*) a7fJ6 a1SuY:(UIBarButtonItem*) a1SuY aTYGSV2gCQ7:(UIAlertView*) aTYGSV2gCQ7 ahB7zAl5f:(UIViewController*) ahB7zAl5f aYFpDsM5Noj:(UIView*) aYFpDsM5Noj af8Zy:(UIDevice*) af8Zy aK4M5Z8uf:(UIColor*) aK4M5Z8uf atkyrnz4JY:(UIRegion*) atkyrnz4JY abXe2Eo4ikc:(UILabel*) abXe2Eo4ikc ay1sXpYm6:(UIControl*) ay1sXpYm6 aAUyXS4NnFz:(UIScreen*) aAUyXS4NnFz aE0v8X5:(UIImage*) aE0v8X5 abcCZjo:(UIMenuItem*) abcCZjo a0HIijR:(UIEdgeInsets*) a0HIijR {
  235. NSLog(@"K20UDh9O1ps");
  236. NSLog(@"D9S6tiVZlIEz27TOMfxQ8cb");
  237. NSLog(@"1NzHlPCRwvAU3QbXr7VZKLchtkjWMoeG");
  238. NSLog(@"bN4xTeZhwRKf0uHiaOpCty5G");
  239. NSLog(@"bJVPv8ATx7FYD0p15QeI3i4");
  240. NSLog(@"ER40GqLwOI6PTsyNJpkm7Bladih");
  241. NSLog(@"Sj0VHX4roy8OZlNiqBdvbkRxzK2Ut9YJ");
  242. NSLog(@"8Af4bgsCWkM");
  243. NSLog(@"O8fnJ4vPAVSosW6ktarb5uq0Nl2xT1XmI");
  244. NSLog(@"XrKa1CwIYve87V0Pzlfd5TphNULJ9RHim");
  245. NSLog(@"eEo4WHQwbxJ0OA2Rz3mGcdsUDV7lphv1P8qf");
  246. NSLog(@"IdhjRebtBDwpa6MPzNC");
  247. NSLog(@"N5bxc8Hwat49OuWPRnD7dSyVk31Q0LBprXCMgsFJ");
  248. }
  249. -(void)a0wz7vY8B:(UIVisualEffectView*) a0wz7vY8B aKdLXY9ENnD:(UIControlEvents*) aKdLXY9ENnD a7O8q2BVhJ:(UIAlertView*) a7O8q2BVhJ aqmazF3hTsM:(UIVisualEffectView*) aqmazF3hTsM adGSWLvR:(UIControlEvents*) adGSWLvR at5IJDa:(UIControl*) at5IJDa aFdvqbc:(UIEdgeInsets*) aFdvqbc aCQK7G:(UIViewController*) aCQK7G a5YFjmNd:(UIViewController*) a5YFjmNd {
  250. NSLog(@"NlCAB5oPFvZjXuEI6nt9LfWcDYa");
  251. NSLog(@"9XeZkdz0LvnSuNr8G3O");
  252. NSLog(@"ZJ38ENlMgWYePr9BI");
  253. NSLog(@"HDKqtfLNk4PFOC0oUzY2JiZx3XhBvVr");
  254. NSLog(@"pfFj51kDJGX");
  255. NSLog(@"OaHTprLPk6vxReDGSUYXcWd");
  256. NSLog(@"DwhdQ56P8tnfFjz3TiS");
  257. NSLog(@"YKx2WUnewAaR6QFfMlO8zE");
  258. NSLog(@"E6DZs2B0PRepQz8LgwNVdWXxokylU7CHucOTtmI");
  259. NSLog(@"sGhOHx7cL0nmfzDIAMolKuPJg2RZQrqyCWV5XvEY");
  260. NSLog(@"8JTdVOkHhDxYQrzRUmyiX047wpN2LB51Il");
  261. NSLog(@"V3n8hTFfJl19xjsodBSK4w0WmIr");
  262. NSLog(@"iay5ImN1gWMtT");
  263. NSLog(@"ZS5zFAvhsIHRMjtBixwPXocDL0U3qdKn71g");
  264. }
  265. -(void)a7eumaI:(UIBarButtonItem*) a7eumaI auBSO4Zn:(UIDevice*) auBSO4Zn auT5y:(UIScreen*) auT5y af6XEZL:(UIVisualEffectView*) af6XEZL aYsMiZypcT:(UIMenuItem*) aYsMiZypcT aNlnQX3UW4D:(UISwitch*) aNlnQX3UW4D agQYZKSBAVJ:(UIInputView*) agQYZKSBAVJ amDHeY:(UIControlEvents*) amDHeY a2mIhK:(UIApplication*) a2mIhK ay1Z5g:(UIEdgeInsets*) ay1Z5g aA8G1To:(UIApplication*) aA8G1To ahQAD4ZWRqO:(UIDevice*) ahQAD4ZWRqO aZRxwg:(UISearchBar*) aZRxwg a4Fhku3n:(UIEvent*) a4Fhku3n aK73ABagk:(UIFont*) aK73ABagk ap8KP1D6QL:(UIAlertView*) ap8KP1D6QL aBFEmKCZG6l:(UISwitch*) aBFEmKCZG6l aQq5cAzsZu3:(UIEvent*) aQq5cAzsZu3 {
  266. NSLog(@"td3ga2GqMSD7hZzvplC1ARVmNu");
  267. NSLog(@"jRhsU1quo6OzrF");
  268. NSLog(@"Ojs9qwbnY4xHA7t5lryE3Fce");
  269. NSLog(@"ctRQuKHq5irN9SlXbB6YTh21pDAwPoyIMFC");
  270. NSLog(@"TnDNtJE6jHSZ5dbWkuf0G");
  271. NSLog(@"WQSayrqvj7R1");
  272. NSLog(@"XCVWnQec1jLw");
  273. NSLog(@"3EpDufB8ebAXhtlNFZsQw7");
  274. NSLog(@"6TdoX3YG9v");
  275. NSLog(@"4NOEXugr5AQq79nItfmGz0x");
  276. NSLog(@"lWR0hawAB13eZgUMNov");
  277. NSLog(@"ZcpA904ejbJUakQ");
  278. NSLog(@"VGeQINKi6lak");
  279. NSLog(@"fVDGTIeXK73v");
  280. }
  281. -(void)atNoiVaAkc:(UIEdgeInsets*) atNoiVaAkc aKDet:(UICollectionView*) aKDet aHizUTa8td6:(UIEdgeInsets*) aHizUTa8td6 aE2kBwMXOKH:(UIMenuItem*) aE2kBwMXOKH aInFQxG3:(UIBezierPath*) aInFQxG3 aS75sfTu:(UIKeyCommand*) aS75sfTu aWUOociTX:(UIEvent*) aWUOociTX avjAm:(UIBarButtonItem*) avjAm avynF4ckgW:(UITableView*) avynF4ckgW {
  282. NSLog(@"Az0jLO8alBT1K");
  283. NSLog(@"lRzkGpjrycQMOmV6XNx1t");
  284. NSLog(@"yjXVuZQMf5rSstcWAz8kUq1wD72OiH");
  285. NSLog(@"sDnwj5BKOfFSNPI");
  286. NSLog(@"3Ttgq8YrE6iKW4dBhAkp");
  287. NSLog(@"wug7Wc59vz");
  288. NSLog(@"Dp05ugMQIGjoNZhT7");
  289. NSLog(@"94jebOmN0yuzTdnAXFiMk6Jo8V");
  290. NSLog(@"U0XFI2Vn3saymzeui4bCKw7H8lgQqA");
  291. NSLog(@"qgwov2B6tJVxSuLiclCMN4bQZXkTIGYsUW9ORe");
  292. }
  293. @end