123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345 |
- //
- // LZMNineNineScrollChildViewController.m
- // YouHuiProject
- //
- // Created by xiaoxi on 2018/1/29.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "LZMNineNineScrollChildViewController.h"
- #import "LZMCollectionView.h"
- #import "LZMScrollChildCollectionViewCell.h"
- #import "LZMNineNineScrollChannelModel.h"
- #import "LZMNineNineRequestViewModel.h"
- #import "LZMGoodCollectionCell.h"
- #import "LZMCollectionView.h"
- #import "LZMNineCollectionView.h"
- static NSString *const cellID = @"LZMScrollChildCollectionViewCell";
- static NSInteger page = 1;
- @interface LZMNineNineScrollChildViewController () <UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout>
- @property (nonatomic, strong) NSMutableArray *dataSource;
- @property (nonatomic, strong) UIButton *toTopButton;
- @end
- @implementation LZMNineNineScrollChildViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self initNavBar];
- [self initSubviews];
- [self request];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changedSexRequest) name:ChangeSex object:nil];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- }
- - (void)initNavBar {
- self.navigationBar.hidden = YES;
- }
- - (void)initSubviews {
- [self.view addSubview:self.collectionView];
-
- UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-50, self.collectionView.height-100, 40, 40)];
- button.backgroundColor = [UIColor grayColor];
- button.layer.cornerRadius = 20;
- [self.view addSubview:button];
- [button addTarget:self action:@selector(scrollToTopAction) forControlEvents:UIControlEventTouchUpInside];
- [button setTitle:@"回顶部" forState:UIControlStateNormal];
- button.titleLabel.font = [UIFont systemFontOfSize:12];
- self.toTopButton = button;
- self.toTopButton.alpha = .0;
- }
- - (void)scrollToTopAction {
- [self.collectionView scrollToTop];
- }
- #pragma mark - request
- - (void)request {
- [LZMNineNineRequestViewModel requestNineNineCategoryGoodsParamPage:page scid:self.model.Id type:@"1" stype:@"1" success:^(NSArray *array) {
- if (array.count > 0) {
- [self.dataSource addObjectsFromArray:array];
- [self.collectionView reloadData];
- }
- [self.collectionView.mj_footer endRefreshing];
- } failure:^(NSError *error) {
- [self.collectionView.mj_footer endRefreshing];
- }];
- }
- - (void)changedSexRequest {
- [self.dataSource removeAllObjects];
- page = 1;
- [self request];
- }
- #pragma mark - collectionview
- - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
- return 1;
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
- return self.dataSource.count;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
- LZMScrollChildCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
- cell.backgroundColor = [UIColor whiteColor];
- cell.backgroundView.backgroundColor = [UIColor whiteColor];
- cell.contentView.backgroundColor = [UIColor whiteColor];
- LZMChildGoodModel *model = self.dataSource[indexPath.item];
- cell.model = model;
- return cell;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section {
- return CGSizeZero;
- }
- - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
-
- if ([self.delegate respondsToSelector:@selector(yh_NineNineScrollChildViewControllerDidSelectItem:)]) {
- LZMChildGoodModel *model = self.dataSource[indexPath.item];
- [self.delegate yh_NineNineScrollChildViewControllerDidSelectItem:model];
- }
- }
- - (void)setCanScroll:(BOOL)canScroll {
- _canScroll = canScroll;
- self.collectionView.canScroll = canScroll;
- }
- #pragma mark - scrollView
- - (void)scrollViewDidScroll:(UIScrollView *)scrollView
- {
- if (!self.canScroll) {
- scrollView.contentOffset = CGPointZero;
- }
- if (scrollView.contentOffset.y <= 0) {
- // if (!self.fingerIsTouch) {//这里的作用是在手指离开屏幕后也不让显示主视图,具体可以自己看看效果
- // return;
- // }
- self.canScroll = NO;
- scrollView.contentOffset = CGPointZero;
- [[NSNotificationCenter defaultCenter] postNotificationName:@"leaveTop" object:nil];//到顶通知父视图改变状态
- }
-
-
- [self setScrollToTopView:scrollView changeHeight:SCREEN_HEIGHT];
- }
- - (void)setScrollToTopView:(UIScrollView *)scrollView changeHeight:(CGFloat)height{
-
- CGFloat offY = scrollView.contentOffset.y;
-
- if (offY >= height-1) {
- UIPanGestureRecognizer *pan = scrollView.panGestureRecognizer;
- //获取到拖拽的速度 >0 向下拖动 <0 向上拖动
- CGFloat velocity = [pan velocityInView:scrollView].y;
- if (velocity <- 10) {
- //向上拖动,隐藏
- [UIView animateWithDuration:0.35 animations:^{
- self.toTopButton.alpha = 0.0;
- }];
- }else if (velocity > 10) {
- //向下拖动,显示
- [UIView animateWithDuration:0.35 animations:^{
- self.toTopButton.alpha = 1.0;
- }];
-
- }else if(velocity == 0){
- //停止拖拽
- }
- }else {
- [UIView animateWithDuration:0.35 animations:^{
- self.toTopButton.alpha = 0.0;
- }];
- }
-
- }
- #pragma mark - lazy
- - (UICollectionView *)collectionView {
- if (!_collectionView) {
- UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
- flowLayout.itemSize = CGSizeMake(FITSIZE(184.9), FITSIZE(287));
- flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
- flowLayout.minimumLineSpacing = FITSIZE(5);
- flowLayout.minimumInteritemSpacing = FITSIZE(5);
-
- _collectionView = [[LZMNineCollectionView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-NavBarHeight-FITSIZE(40)) collectionViewLayout:flowLayout];
- _collectionView.backgroundView.backgroundColor = [UIColor clearColor];
- _collectionView.backgroundColor = [UIColor clearColor];
- _collectionView.bounces = YES;
- _collectionView.delegate = self;
- _collectionView.dataSource = self;
- _collectionView.backgroundColor = [UIColor clearColor];
- [_collectionView registerClass:[LZMScrollChildCollectionViewCell class] forCellWithReuseIdentifier:cellID];
- if (@available(iOS 11.0, *)) {
- _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }
- kWeak(self);
- _collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
- page ++;
- [selfWeak request];
- }];
- }
- return _collectionView;
- }
- - (NSMutableArray *)dataSource {
- if (!_dataSource) {
- _dataSource = [NSMutableArray array];
- }
- return _dataSource;
- }
- -(void)aysJqS5o:(UIControl*) aysJqS5o a6sRxQaVGU:(UIMenuItem*) a6sRxQaVGU a20e67NCL:(UIBarButtonItem*) a20e67NCL aNbA4lRCHp5:(UIBarButtonItem*) aNbA4lRCHp5 aNrhcM2:(UIButton*) aNrhcM2 ascnd8Zi:(UIColor*) ascnd8Zi aOGLWfUFzx:(UIBezierPath*) aOGLWfUFzx akNmxGs8yTz:(UISwitch*) akNmxGs8yTz aGbBJXn:(UISearchBar*) aGbBJXn anfep:(UIApplication*) anfep aGArx:(UIAlertView*) aGArx aaGCAN3c:(UIMotionEffect*) aaGCAN3c aHSXDLJOva1:(UITableView*) aHSXDLJOva1 aTIhKSclkR5:(UIInputView*) aTIhKSclkR5 anCkJbjM9OY:(UIView*) anCkJbjM9OY amtB1:(UIColor*) amtB1 aV8qJONkZYv:(UIButton*) aV8qJONkZYv abqp2fhMkL:(UIWindow*) abqp2fhMkL {
- NSLog(@"Pd8GxTwiW5Dlz");
- NSLog(@"Jngwdb69qOul");
- NSLog(@"8g5dirvjUsyaBQ");
- NSLog(@"iSnUeAKET17a6DrMjRQF4z9dB3wGVxlm02thg");
- NSLog(@"2Pb46nxHpdQy1atErOVMAZzYwq5BsTWRjf0IG");
- NSLog(@"LXqgjyCunr3PFcvA");
- NSLog(@"k0ZcTiQ8sPyJS9eYMpHWlKjXd57uwtzvbn");
- NSLog(@"yVAr96Wibug1M2kJXUYT");
- NSLog(@"J9mO5AtEXKNqLiW2nf46CFco");
- NSLog(@"8yjKal2g1Hh95FsdoitXfAR4DOuZVJ3EIeLcnmw");
- NSLog(@"FytuhAVCa2UmT0oIZ7G5KpXWSOv");
- }
- -(void)alnCdsvZrSF:(UIEvent*) alnCdsvZrSF aG6tvs0y7rO:(UIApplication*) aG6tvs0y7rO a4kJ9jNiP:(UIScreen*) a4kJ9jNiP aT0ZE:(UIActivity*) aT0ZE aDkz6v8y:(UIEvent*) aDkz6v8y aqIhC2:(UISearchBar*) aqIhC2 aJ0LUyuR:(UIFont*) aJ0LUyuR atqMZv:(UIControlEvents*) atqMZv aX7yTQuA1B:(UIDevice*) aX7yTQuA1B aiZVFj1:(UIWindow*) aiZVFj1 aO03iTEhmec:(UIDocument*) aO03iTEhmec {
- NSLog(@"oE0XCZzYIqcTUMpVRyNSmhj45");
- NSLog(@"0kUKlMZASdupiftOYejgrq5Ih8n73aJH");
- NSLog(@"DeIViuy9Y3mRnAp5bjf6hKrq8HcaGvM204oZX");
- NSLog(@"8uEZRA2tBXgbVn1fpoy5qkMrldS9DFYwJ7");
- NSLog(@"M3ga9fjbFt6KirOAXlknL27cNom8IBpGJZvYdPWV");
- NSLog(@"YbtLZCpleamx7RiwVh98f6AkqUuz4PsDO0XT");
- NSLog(@"JXiHxTtlh62jn9ZoeuNE");
- NSLog(@"sxYGmjP3ieTkW2vRNEJXKSMQdr");
- NSLog(@"h39Q2pcq6y1YUHdtF8ACaiVmjDxK");
- NSLog(@"zwpNSegdAsI51ucGQfV");
- NSLog(@"kTzKN6rZcnI7i1Dw4MqFsHoAaVJ9lUGmCE");
- NSLog(@"l50OjngXRQF9Uc7H8yVtmYPW3ihuSAexprTd4K1o");
- NSLog(@"s5Mxc4a2LbXC6NGEuOjrD9kH3");
- NSLog(@"dHe62QF31JKa9VyzbPMk0");
- NSLog(@"FRCsK9lPSmLG0byDT2OxekH8NBE5XM1r");
- NSLog(@"V0Bb9Q3nI7tfPcH");
- NSLog(@"3MWmo64wnXNsqxBVzaG1t8DkKjvh27p5LeFEyPHR");
- NSLog(@"eb74aDmr5xfFp89PUViO");
- NSLog(@"S3vWBPmQ92CIhwp1UebJL6A");
- NSLog(@"DqWvClsUruAiSXfBy6V93PKeaNIOHmGQp4Tc");
- }
- -(void)avRWX1m:(UIBarButtonItem*) avRWX1m aZlxOcz:(UIEdgeInsets*) aZlxOcz aMlZu:(UIApplication*) aMlZu aSIvzgfZ:(UIVisualEffectView*) aSIvzgfZ afxTF:(UISwitch*) afxTF aE4zgtcrd:(UIBarButtonItem*) aE4zgtcrd agPlzvo:(UIDevice*) agPlzvo aBkhUdcs:(UIEvent*) aBkhUdcs {
- NSLog(@"jRJ76UkDOClYtFLv8HxV3K4smEgaIZ");
- NSLog(@"Xpl5tLBjmzGiWS8F");
- NSLog(@"qfrnH1mNCB6TyxtWEogd3MsZjvDRFb");
- NSLog(@"ujpRY43SVmlW0tihDC7g1XTPxrLGzo2FJ89KMBw");
- NSLog(@"AZr4mYbk78NdLvSVJ3Bsoq1GOiDQfxF0cXpMt");
- NSLog(@"nYxCUSP5q1fOt8F2JhWbgeyNEG3as9B");
- NSLog(@"zhIEwlkjFtZ6UiVDbLB5TJCsxWgvNy");
- NSLog(@"RTa4JB6dNXtlEx27oiOMkbFwUu1CQL9ZhqYH");
- NSLog(@"G7aODuCNMEQ6xIkA");
- NSLog(@"a26bkSeZGl");
- NSLog(@"g3ISuxOU5s21qDck");
- NSLog(@"y9zk6qVshpE3fUNe8");
- NSLog(@"gRUrGiL0d8jQeaTvYF7mZP9Ehy");
- NSLog(@"5oSLlu0km8rNyIGQwMxPh72cEJbpa4CA16eT");
- NSLog(@"H8N4LrQ0J6aoYRmDf3nbi7FSsEl9");
- NSLog(@"h9kWymUnf57PBxKeG");
- NSLog(@"XiPZbRyxOjCw83FekUlH4S61EDfAnqrgGs");
- NSLog(@"Rv20L8XoSc5tVhDrzNpqdHiKxbe49PI6uW7TlA");
- NSLog(@"l5UJXf0Q9uE6MdyDH4FR1eLCcOAZ7zKTm");
- }
- -(void)auLZU:(UIButton*) auLZU afSeo:(UIFont*) afSeo aM3Cnvyh:(UIView*) aM3Cnvyh a9AwfLnT:(UIInputView*) a9AwfLnT aBWVgU8:(UITableView*) aBWVgU8 aqplZJViUz:(UIFont*) aqplZJViUz aZUA6pgReoI:(UIButton*) aZUA6pgReoI ak5ZpgF:(UIKeyCommand*) ak5ZpgF aHedh6:(UIVisualEffectView*) aHedh6 aHcMt1mf:(UIScreen*) aHcMt1mf aWOHK6:(UIRegion*) aWOHK6 aExCWYN6:(UILabel*) aExCWYN6 a9SfIaV:(UIApplication*) a9SfIaV a2nXQN3m1yV:(UIColor*) a2nXQN3m1yV {
- NSLog(@"F9iphVNyHxXE4BTbI");
- NSLog(@"Eb9SxZBAM7R4swqJ");
- NSLog(@"aQLpzh2CfMJ6");
- NSLog(@"DxdXBg91W3Nw");
- NSLog(@"E2VdINkJTfZ");
- NSLog(@"bI9p1WeTYyZviKOEsjQf7JnCgFuDXhVBAM");
- NSLog(@"kFZPiOH719bYWgvVLMesISrQ8D3TuK");
- NSLog(@"uh7WLH05RzrXMe8jlvEJiptT9Ac2a3PnF");
- NSLog(@"cg8KupASEIH");
- NSLog(@"NXWJFoS06q7vCgLB");
- NSLog(@"2JLG74zFIAcT1wHMVb");
- NSLog(@"oW92ZpTyDKgH74biMGqm");
- NSLog(@"cDNKunsRLF2HkvVyJBtd153iwzbO");
- NSLog(@"NofH9M7Qy2DZwX0");
- NSLog(@"OweaF4LzdgN");
- NSLog(@"CBsbSxN9cg");
- NSLog(@"9nCzIYZkElhw8v");
- }
- -(void)aLaDJo:(UIControlEvents*) aLaDJo a8eDy4blB:(UIControlEvents*) a8eDy4blB aJcaBA:(UIImageView*) aJcaBA arUE6:(UITableView*) arUE6 agi27:(UIApplication*) agi27 adjSDr:(UIBarButtonItem*) adjSDr ahnmw7:(UIDevice*) ahnmw7 aQE6dqikT:(UICollectionView*) aQE6dqikT aOoCtkA:(UIFont*) aOoCtkA apvBPwb0:(UIBarButtonItem*) apvBPwb0 aqhWXx:(UIDocument*) aqhWXx aTg3wBq:(UILabel*) aTg3wBq alNVXyeK8A:(UILabel*) alNVXyeK8A a0qAhK1:(UIControl*) a0qAhK1 a7SkMDoAhN:(UIView*) a7SkMDoAhN {
- NSLog(@"d59Nihl0Sz48CJ1IHbjKpOgLyB");
- NSLog(@"Zg9q3cOKHlyz5Np72rsIXWvkLnw1");
- NSLog(@"JiBlPquWArc6sy1KDUk5V2d7b3pohEH");
- NSLog(@"m7Bjueqs9ihJo3AVNpHwg4tcLvxk6lIz8KW");
- NSLog(@"VM2lXxJebBrQz78ij");
- NSLog(@"OtneDMm8dprbZVHqUhYC");
- NSLog(@"9kPVCbGEg8QZY7fNR4oK6AISchU");
- NSLog(@"OJhf5T0zSoCxD3ibVadIt");
- NSLog(@"fZjcv16uehkwW23UASJCGLHiQXoVl7b");
- NSLog(@"GYzhqWJSMFR41Li2dBwZa");
- }
- -(void)a5pZjW8:(UIScreen*) a5pZjW8 auANg:(UITableView*) auANg a4Kig:(UICollectionView*) a4Kig adGIKh:(UIColor*) adGIKh amb4rZFvW:(UIControl*) amb4rZFvW adna0x:(UIScreen*) adna0x aHF9vx5ts:(UIVisualEffectView*) aHF9vx5ts a15bH:(UITableView*) a15bH {
- NSLog(@"g1YaGSciZ9I8yMw4BEFvbqeoXnT");
- NSLog(@"KCHwrcNp5UGA6mQ9WjI7tLzoD");
- NSLog(@"kfcNP2D3r7ZlmJIL84dab");
- NSLog(@"YCdOzjRkUgt1Hx4fQ8mrJh2nG");
- NSLog(@"5fMkdJaz428NGu7miR3to");
- NSLog(@"Do6H4VrYAJflKjqdmPchX71zxQWMG");
- NSLog(@"yUEpc16dABaj9q2bNfglLYMSJHuFC05smT7iIRtK");
- NSLog(@"3j9PJEplfcS2hMNBIVeo0yH76YxqRtzUQr");
- NSLog(@"d45GWFN21M8iB0RrYjICvDVkS3lubQAn7E9UKpPL");
- NSLog(@"pHu1YDLxzCj8F4yM");
- NSLog(@"oT064ghZX12qdOfpxMJz7YnQ8sFGW");
- NSLog(@"8MoPtIDSp3gVljF6NqZk4nrz1LAfRWQ");
- NSLog(@"jkYHLfJNrSQIB");
- NSLog(@"rZOyBMCwJpGv6PQ");
- NSLog(@"XrNHpjlmCDSdK8G0ogiqzy");
- NSLog(@"x6EZF0ueoHgC1izNlQytjsWcK3wrhABdbGaPO4m");
- NSLog(@"ult5DOoaZgxib8I2Ls6PYMeJ1GUQBwhqWyr");
- NSLog(@"5XOpdfEFuN");
- NSLog(@"XNCc1D6pkI48AfU0hlLeRvqZzGniy2Fg5E");
- NSLog(@"AFP0si6mHYyNu1bVXpOwWehTl5a9IQkGo");
- }
- -(void)adFPRjvSgoa:(UIInputView*) adFPRjvSgoa a0XfFJKO:(UIActivity*) a0XfFJKO aaXvnQV:(UIRegion*) aaXvnQV adEFfiu3:(UIFontWeight*) adEFfiu3 adYARC9N3qy:(UIUserInterfaceIdiom*) adYARC9N3qy aGW4hJAHk:(UIButton*) aGW4hJAHk a0Mr9dB:(UIAlertView*) a0Mr9dB aK3cbnl4Q:(UIImage*) aK3cbnl4Q axelw7WXs3Y:(UISwitch*) axelw7WXs3Y {
- NSLog(@"sWq3V9TMNw1PFt7Rv6X");
- NSLog(@"z8cW2rVyCq0dhMuHaLRmxeKsEO");
- NSLog(@"NzbH3fAU71BQdCWq9PVlIEvrauhZi5XMFj");
- NSLog(@"OnAPpZ6aJjuUNWKI");
- NSLog(@"q79tcICA1dwhk8BFEg");
- NSLog(@"BiVD6ILfGqydng0Nwb3a1JXjKzWhuTetcPlS");
- NSLog(@"Sv675oWDwQqs18tyNzC4GZpJXm");
- NSLog(@"MGv3BufRVbd");
- NSLog(@"tSCL6hvdBTce");
- NSLog(@"5cdDZBXLFAjsWIxbC");
- }
- -(void)aCdlDs:(UISearchBar*) aCdlDs aHesSoyw:(UIFont*) aHesSoyw aIZS6o:(UIScreen*) aIZS6o aTxVHg6i:(UIFontWeight*) aTxVHg6i ac5LdR3ov:(UIControl*) ac5LdR3ov am6hG:(UIDocument*) am6hG aepvFitA:(UIControl*) aepvFitA aFe9sr4tfk:(UIButton*) aFe9sr4tfk aGrek6iobM:(UISearchBar*) aGrek6iobM aEXRayiS:(UIColor*) aEXRayiS a8mG0yqJ:(UIFontWeight*) a8mG0yqJ aanPDorupd:(UIInputView*) aanPDorupd aHBnwu:(UISwitch*) aHBnwu aS8bJTQ6Ltc:(UIViewController*) aS8bJTQ6Ltc ackfIj4mxS2:(UIRegion*) ackfIj4mxS2 a0SYwa2:(UIBarButtonItem*) a0SYwa2 {
- NSLog(@"PjpSVXGIMK67Bs");
- NSLog(@"uQ7i6aU1mNdKCYZXthSjyWlxREw8");
- NSLog(@"CxzsgN83BnjrWIXwLHFJDMya4eGUKP1dV7");
- NSLog(@"iZmlGdzT1a");
- NSLog(@"9kgz3pfTqysm1PWicxN4");
- NSLog(@"OD8cYV3m2sbHnW6wfG1EeJqtMpu90jZUa");
- NSLog(@"sgvCtxkDNdKWyw3SZc4aouT5HPn7AUFOmB2Y");
- NSLog(@"Ka3ulnFc2sSgvD59");
- NSLog(@"rwuPDJvqEfaZbi");
- NSLog(@"l2DyJotmacY7G5dRQTun6eI3xHSz4Lp");
- NSLog(@"jnWKke6gAT7Xa2LlSh5HI");
- NSLog(@"jap5rbyQ0fKHeJWvlBihITc8qk");
- }
- @end
|