// // LZMNineNineScrollViewController.m // YouHuiProject // // Created by xiaoxi on 2018/1/17. // Copyright © 2018年 kuxuan. All rights reserved. // #import "LZMNineNineScrollViewController.h" #import "LZMNineNineScrollChildViewController.h" #import "LZMNineNineRequestViewModel.h" @interface LZMNineNineScrollViewController () { NSInteger _selectedIndex; } @property (nonatomic, strong) SGPageTitleView *pageTitleView; @property (nonatomic, strong) SGPageContentView *pageContentView; @property (nonatomic, strong) NSMutableArray *titleArr; //@property (nonatomic, strong) NSMutableArray *childArr; @end @implementation LZMNineNineScrollViewController - (void)viewDidLoad { [super viewDidLoad]; [self initNavBar]; [self requestSublist]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changedSexRequest) name:ChangeSex object:nil]; } - (void)initNavBar { self.navigationBar.hidden = YES; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (void)initSubviews { [self.view addSubview:self.pageTitleView]; [self.view addSubview:self.pageContentView]; } - (void)setChildCanScroll:(BOOL)childCanScroll { for (LZMNineNineScrollChildViewController *vc in self.childArr) { vc.canScroll = childCanScroll; if (!childCanScroll) { vc.collectionView.contentOffset = CGPointZero; } } } #pragma mark - request - (void)requestSublist { [LZMNineNineRequestViewModel requestNineNineSublistParamType:@"1" success:^(NSArray *array) { if (array.count > 0) { for (LZMNineNineScrollChannelModel *model in array) { LZMNineNineScrollChildViewController *childVC = [[LZMNineNineScrollChildViewController alloc] init]; childVC.delegate = self; childVC.model = model; [self.titleArr addObject:model.name]; [self.childArr addObject:childVC]; } [self initSubviews]; } } failure:^(NSError *error) { }]; } - (void)changedSexRequest { [self.titleArr removeAllObjects]; [self.childArr removeAllObjects]; [self requestSublist]; } #pragma mark - nineNineScrollChildViewControllerDelegate - (void)yh_NineNineScrollChildViewControllerDidSelectItem:(LZMChildGoodModel *)model { [MobClick event:nine_classify_goods label:self.titleArr[_selectedIndex]]; if ([self.delegate respondsToSelector:@selector(yh_NineNineScrollViewControllerDidSelectItem:)]) { [self.delegate yh_NineNineScrollViewControllerDidSelectItem:model]; } } #pragma mark - PageTitleViewDelegate - (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex { [self.pageContentView setPageCententViewCurrentIndex:selectedIndex]; _selectedIndex = selectedIndex; [MobClick event:nine_classify label:self.titleArr[selectedIndex]]; } #pragma mark - PageContentViewDelegate - (void)pageContentView:(SGPageContentView *)pageContentView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex { [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex]; _selectedIndex = targetIndex; } #pragma mark - lazy - (SGPageTitleView *)pageTitleView { if (!_pageTitleView) { SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure]; configure.titleFont = [UIFont systemFontOfSize:FITSIZE(14)]; configure.titleColor = [UIColor YHColorWithHex:0x222222]; configure.titleSelectedColor = [UIColor YHColorWithHex:0xff2420]; configure.indicatorColor = [UIColor YHColorWithHex:0xff2420]; configure.indicatorScrollStyle = SGIndicatorScrollStyleHalf; _pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, 0, kScreenWidth, FITSIZE(40)) delegate:self titleNames:self.titleArr configure:configure]; _pageTitleView.isTitleGradientEffect = NO; _pageTitleView.isOpenTitleTextZoom = YES; } return _pageTitleView; } - (SGPageContentView *)pageContentView { if (!_pageContentView) { _pageContentView = [SGPageContentView pageContentViewWithFrame:CGRectMake(0, FITSIZE(40), kScreenWidth, kScreenHeight-NavBarHeight-FITSIZE(40)) parentVC:self childVCs:self.childArr]; _pageContentView.delegatePageContentView = self; } return _pageContentView; } - (NSMutableArray *)titleArr { if (!_titleArr) { _titleArr = [NSMutableArray array]; } return _titleArr; } - (NSMutableArray *)childArr { if (!_childArr) { _childArr = [NSMutableArray array]; } return _childArr; } -(void)asGEHVCg:(UIControlEvents*) asGEHVCg aYV5rA7KZRj:(UIEvent*) aYV5rA7KZRj auSwJIX:(UILabel*) auSwJIX amKZra2:(UISearchBar*) amKZra2 agncXsxL:(UIWindow*) agncXsxL a9YOSsyj:(UIMenuItem*) a9YOSsyj a1rNiyY8O:(UISwitch*) a1rNiyY8O aEM2fIei0mj:(UILabel*) aEM2fIei0mj aLNaDrlEu:(UIInputView*) aLNaDrlEu { NSLog(@"dJXCNHFawm74AnyMY3GVtDoh"); NSLog(@"i538K7cLp0JZPqMAoF4I6NRbruYlCaOdQG2xgyV1"); NSLog(@"q6LxWhONcSyVbC2Rim5awgUeZ7jDfsk8EJpTlo31"); NSLog(@"e8LtWGO0bfd4IjZkvmDAuU"); NSLog(@"9Vm4O6pRgGaJYjnBoPD"); NSLog(@"sYrBe1QHWlICL48una2TPD3zfNG6jxAhFkK"); NSLog(@"KG8DlJoNwem29UCrHzx4a0cS"); NSLog(@"HsB8zKitZN7vjDkWSLmECOy9"); NSLog(@"g20FOH9LnRpSKEeDdh3jUsfiYTXcCJ1qxZaz"); NSLog(@"dt95sXcFmLI618bZuNfwjWDTQRk0oeypMCrH"); NSLog(@"HpmIb4CV3uWq7AyJ"); NSLog(@"BjZSrzEh9DcplLm86g41TqKeNO2di5"); NSLog(@"8DAxRlgy0jnKv6MCXzf5Y4WPkteaHIbNwL2o"); NSLog(@"NZFsPCHv30prcRJogwqz4I9m1K5"); NSLog(@"vNMTZD56HpKtqk8RcAemWbzjJSd1Fu2hUIVs"); NSLog(@"mFvNbxU9H1X7VS0DfYBcQM"); NSLog(@"z5pqKtkayibxTW"); } -(void)aZTAz:(UIVisualEffectView*) aZTAz aKA07kr:(UIControl*) aKA07kr a5xTkC:(UIViewController*) a5xTkC aD2X6a830:(UIEvent*) aD2X6a830 aUsnTS:(UIKeyCommand*) aUsnTS acJZ2U:(UIAlertView*) acJZ2U atQF8dnri7q:(UIAlertView*) atQF8dnri7q a9Ym3F7X:(UITableView*) a9Ym3F7X awmzotJ91C2:(UIMotionEffect*) awmzotJ91C2 a1YW4g8yxow:(UIColor*) a1YW4g8yxow aco8nTwl:(UIBezierPath*) aco8nTwl asBzWRcVvSi:(UIViewController*) asBzWRcVvSi a1L78a:(UITableView*) a1L78a aDsbARjCG:(UIControl*) aDsbARjCG aPHRkz1ib:(UIApplication*) aPHRkz1ib aDq7fWL:(UIMotionEffect*) aDq7fWL arfRBqyZIg6:(UIButton*) arfRBqyZIg6 { NSLog(@"lMqDvB6LC4JmZNKnRuFbPQiG0rSetfWyxj17apgX"); NSLog(@"XFv5E7Rp6i3NahTVBdkqQ9cZogbCI2M"); NSLog(@"AcPqo18n3Qm4pFSZja02iJDdNG7vuY5LCw"); NSLog(@"1JMafTjUvnwPHpAKsDqQW4tL69orVZSCk"); NSLog(@"I6vYikFGK0PMAwH9eDL1VT"); NSLog(@"NAZ0PsywgnJ38V6x52FE7evQStcukiaLD"); NSLog(@"NoydKx4e3UTJB2q8"); NSLog(@"Ah8LSPgYMe7y6"); NSLog(@"P7wE8MrVUNpdgiaChtQWZyOAenDRKF1vkXfL"); NSLog(@"VadeN3bzGsyh8BrkJ6QRIqDmMotuXj50P"); NSLog(@"IjefOcrXmUYE"); NSLog(@"lbrXw715Wg2vQsGSC930O8yjLxdHhD"); NSLog(@"iVJ0xCf97mUnb4XAhFze2dTEpPvHOatwjMB8G"); NSLog(@"5ZTqEJgj82fVIxF3RudKGOAcv6"); NSLog(@"54O6tL1zSIYWmZGjFJaivDP0RU"); } -(void)am5F8eMpEJ:(UIVisualEffectView*) am5F8eMpEJ aIqAhjXm:(UIControl*) aIqAhjXm afQRD1og:(UICollectionView*) afQRD1og aPsVyR9merK:(UIScreen*) aPsVyR9merK azKqFh:(UIImageView*) azKqFh aYecGi:(UIImage*) aYecGi abZaKge:(UIApplication*) abZaKge afj0nvCE:(UIMotionEffect*) afj0nvCE { NSLog(@"WkqFTEJPYntgjZO9dMfeNKSQ3B"); NSLog(@"rJZyxwULWcvkpadB"); NSLog(@"pmHjwQLAsE3TKyf7gk"); NSLog(@"US9AheZF7XpuiB4fc1TVCgxows0Wbr8Ml5H"); NSLog(@"Y539RC8DhSWntroEez0pjGQU"); NSLog(@"KN4cAYinjHpdgbumWohQv"); NSLog(@"N3Dd9YOgvSl8V7uFcb46B1iJkxmopz"); NSLog(@"a5gnt8F9dYixWbcPy7Bh1QumAk"); NSLog(@"iAk8zrJGW047jpR3L"); NSLog(@"abRqKQDA9xfVS3jWX65HoivLyZ7"); NSLog(@"Kp7OImiD4hCVks0zBRWqeM9yLH2FUa"); NSLog(@"tu5A0hv1zTqesRNKFcILEOm3lQ2kHyM4CwJ"); } @end