口袋优选

KBFindSearchResultViewController.m 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583
  1. //
  2. // KBFindSearchResultViewController.m
  3. // YouHuiProject
  4. //
  5. // Created by xiaoxi on 2018/2/1.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBFindSearchResultViewController.h"
  9. #import "KBGoodCollectionCell.h"
  10. #import "KBChildGoodModel.h"
  11. #import "KBGoodListViewController.h"
  12. #import "KBGoodDetailViewController.h"
  13. #import "KBFindRequestViewModel.h"
  14. #import "KBCollectionView.h"
  15. #import "KBGoodHorzitolCollectionCell.h"
  16. #import "KBSearchNoDataView.h"
  17. #import "KBSearchTitleView.h"
  18. #import "KBSearchSpecialView.h"
  19. #import "SelectView.h"
  20. #import "AdJumpManager.h"
  21. static NSString *const cellID = @"KBGoodCollectionCell";
  22. static NSString *const HorzitolCellId = @"KBGoodHorzitolCollectionCell";
  23. static NSString *const collectionViewHeaderTop = @"top";
  24. static NSString *const collectionViewHeaderMiddle = @"middle";
  25. static NSString *const collectionViewSpecailHeader = @"specailHeader";
  26. //static BOOL isNoData = NO;
  27. static CGFloat selectedViewHeight = 80.f;
  28. typedef enum : NSUInteger {
  29. ResultCellTypeVertical,
  30. ResultCellTypeHorzitol,
  31. } ResultCellType;
  32. @interface KBFindSearchResultViewController ()
  33. <
  34. UICollectionViewDelegate,
  35. UICollectionViewDataSource,
  36. UICollectionViewDelegateFlowLayout,
  37. UIGestureRecognizerDelegate,
  38. YHSearchNoDataViewDelegate,
  39. NY_SelectViewDelegate
  40. >
  41. {
  42. NSString *_type; //1->默认 2->销量由高到低 3->价格由高到低 4->价格由低到高 5-综合筛选
  43. NSString *_maxPrice; //最高价格
  44. NSString *_minPrice; //最低价格
  45. NSInteger page;
  46. NSInteger guessYouLikePage;
  47. NSInteger _is_has_coupon;
  48. BOOL isNoData;
  49. }
  50. @property (nonatomic, strong) UICollectionView *collectionView;
  51. @property (nonatomic, strong) NSMutableArray *goodsArr;
  52. @property (nonatomic, strong) SelectView *selectedView;
  53. @property (nonatomic, assign) ResultCellType cellType;
  54. @property (nonatomic, strong) NSArray *filtrateArray;
  55. @property (nonatomic, strong) NSDictionary *special_search;
  56. @property (nonatomic, strong) AdPopModel *adModel;
  57. @end
  58. @implementation KBFindSearchResultViewController
  59. - (void)viewDidLoad {
  60. [super viewDidLoad];
  61. [self requesFiltrateParam];
  62. [self configDefauleParamKey];
  63. [self initNavBar];
  64. [self initSubviews];
  65. }
  66. - (void)viewWillAppear:(BOOL)animated {
  67. [super viewWillAppear:animated];
  68. [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
  69. self.navigationController.navigationBar.hidden = NO;
  70. }
  71. - (void)viewWillDisappear:(BOOL)animated {
  72. [super viewWillDisappear:animated];
  73. self.navigationController.navigationBar.hidden = self.hiddenNavigationWhenPop;
  74. [LoadingView dismiss];
  75. }
  76. - (void)willMoveToParentViewController:(UIViewController *)parent {
  77. [super willMoveToParentViewController:parent];
  78. //处理侧滑手势
  79. if (!parent) {
  80. [self.navigationController setNavigationBarHidden:NO animated:NO];
  81. self.selectedView.y = 0;
  82. if (self.special_search) {
  83. self.collectionView.y = 0;
  84. self.collectionView.height = kScreenHeight-NavBarHeight;
  85. }else {
  86. self.collectionView.y = selectedViewHeight;
  87. self.collectionView.height = kScreenHeight-NavBarHeight-selectedViewHeight;
  88. }
  89. }
  90. }
  91. - (void)didReceiveMemoryWarning {
  92. [super didReceiveMemoryWarning];
  93. }
  94. - (void)configDefauleParamKey {
  95. page = 1;
  96. guessYouLikePage = 1;
  97. _type = @"1";
  98. _minPrice = @"0";
  99. _maxPrice = @"-1";
  100. }
  101. - (void)initNavBar {
  102. self.view.backgroundColor = [UIColor yhGrayColor];
  103. if ([self respondsToSelector:@selector(setAutomaticallyAdjustsScrollViewInsets:)]) {
  104. self.automaticallyAdjustsScrollViewInsets = YES;
  105. }
  106. UIView *statusBarBgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, KStatusBarHeight)];
  107. statusBarBgView.backgroundColor = [UIColor yhGrayColor];
  108. // [self.view addSubview:statusBarBgView];
  109. UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
  110. [button setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  111. [button setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 0)];
  112. [button addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  113. self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
  114. UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
  115. [rightBtn setImage:[UIImage imageNamed:@"Vertical_items"] forState:UIControlStateNormal];
  116. [rightBtn setImage:[UIImage imageNamed:@"Horizontal_items"] forState:UIControlStateSelected];
  117. [rightBtn addTarget:self action:@selector(switchItemsType:) forControlEvents:UIControlEventTouchUpInside];
  118. self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
  119. NSNumber *cellType = [[NSUserDefaults standardUserDefaults] objectForKey:@"ResultCellType"];
  120. if (cellType) {
  121. self.cellType = cellType.integerValue;
  122. }else {
  123. self.cellType = ResultCellTypeVertical;
  124. }
  125. rightBtn.selected = self.cellType==ResultCellTypeHorzitol?YES:NO;
  126. self.navigationController.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
  127. KBSearchTitleView *titleView = [[KBSearchTitleView alloc] initWithFrame:CGRectMake(0, 0, FITSIZE(270), 32) searchName:self.searchName click:^{
  128. [self backAction];
  129. }];
  130. titleView.closeBlock = ^{
  131. [self backAction];
  132. self.searchBar.text = nil;
  133. };
  134. self.navigationController.navigationBar.translucent = NO;
  135. self.navigationItem.titleView = titleView;
  136. }
  137. - (void)backAction {
  138. [self.navigationController popViewControllerAnimated:NO];
  139. }
  140. - (void)switchItemsType:(UIButton *)sender {
  141. sender.selected = !sender.selected;
  142. self.cellType = sender.selected ? ResultCellTypeHorzitol:ResultCellTypeVertical;
  143. [[NSUserDefaults standardUserDefaults] setObject:@(self.cellType) forKey:@"ResultCellType"];
  144. [[NSUserDefaults standardUserDefaults] synchronize];
  145. [self.collectionView reloadData];
  146. }
  147. - (void)initSubviews {
  148. [self.view addSubview:self.collectionView];
  149. // [self.view addSubview:self.selectedView];
  150. [LoadingView show];
  151. }
  152. #pragma mark - request
  153. /**
  154. 加载筛选范围
  155. */
  156. - (void)requesFiltrateParam {
  157. NSString *urlString = [NSString stringWithFormat:@"%@/api/categoryNew/priceSection", BaseURL];
  158. [KBHttp post:urlString params:nil success:^(id json) {
  159. self.filtrateArray = json[@"data"];
  160. [self requestVoucherFindIsRefresh:NO switchButton:nil];
  161. } failure:^(NSError *error) {
  162. }];
  163. }
  164. - (void)requestVoucherFindIsRefresh:(BOOL)refresh switchButton:(UIButton *)switchButton{
  165. if (refresh) {
  166. [LoadingView show];
  167. }
  168. NSDictionary *param = @{@"page":@(page),
  169. @"keyword":self.searchName,
  170. @"sort":_type,
  171. @"min_price":_minPrice,
  172. @"max_price":_maxPrice,
  173. @"is_has_coupon":@(_is_has_coupon)
  174. };
  175. NSString *urlString = [NSString stringWithFormat:@"%@/api/v2/goods/search", BaseURL];
  176. [KBHttp post:urlString params:param success:^(id json) {
  177. [self.view addSubview:self.selectedView];
  178. NSArray *arr = [NSArray yy_modelArrayWithClass:[KBChildGoodModel class] json:json[@"data"]];
  179. self.special_search = json[@"special"];
  180. self.adModel = [AdPopModel yy_modelWithJSON:json[@"special"]];
  181. if (refresh) {
  182. [self.goodsArr removeAllObjects];
  183. [self.collectionView reloadData];
  184. }
  185. //首先判断special_search有没有数据,如果没有再去判断商品列表
  186. if (self.special_search != nil) {
  187. self.selectedView.hidden = YES;
  188. self.collectionView.y = 0;
  189. self.collectionView.height = SCREEN_HEIGHT-NavBarHeight;
  190. [self.collectionView.mj_footer endRefreshingWithNoMoreData];
  191. if (page == 1) {
  192. [self requestGuessYouLike];
  193. }
  194. [self.collectionView reloadData];
  195. }else {
  196. if (arr.count > 0) {
  197. [self.collectionView.mj_footer endRefreshing];
  198. [self.goodsArr addObjectsFromArray:arr];
  199. [self.collectionView reloadData];
  200. if (page == 1) {
  201. isNoData = NO;
  202. self.collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  203. page ++;
  204. [self requestVoucherFindIsRefresh:NO switchButton:nil];
  205. }];
  206. self.collectionView.footRefreshState = MJFooterRefreshStateNormal;
  207. }
  208. }
  209. else {
  210. [self.collectionView.mj_footer endRefreshingWithNoMoreData];
  211. if (page == 1) {
  212. isNoData = YES;
  213. [self requestGuessYouLike];
  214. }
  215. }
  216. }
  217. [LoadingView dismiss];
  218. switchButton.selected = !switchButton.selected;
  219. } failure:^(NSError *error) {
  220. [self.collectionView.mj_footer endRefreshing];
  221. [LoadingView dismiss];
  222. [MBProgressHUD showMessage:@"该商品未参加优惠券和返佣推广活动,建议亲换个店铺试试"];
  223. }];
  224. }
  225. - (void)requestGuessYouLike {
  226. [KBFindRequestViewModel requestGuessYouLikeParamPage:guessYouLikePage success:^(NSArray *array) {
  227. if (array.count > 0) {
  228. [self.goodsArr addObjectsFromArray:array];
  229. [self.collectionView reloadData];
  230. if (guessYouLikePage == 1) {
  231. kWeak(self);
  232. _collectionView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  233. guessYouLikePage ++;
  234. [selfWeak requestGuessYouLike];
  235. }];
  236. }
  237. }
  238. [self.collectionView reloadData];
  239. [self.collectionView.mj_footer endRefreshing];
  240. } failure:^(NSError *error) {
  241. [self.collectionView.mj_footer endRefreshing];
  242. [LoadingView dismiss];
  243. [MBProgressHUD showMessage:@"加载失败"];
  244. }];
  245. }
  246. #pragma mark - SearchNoDataViewDelegate
  247. - (void)yh_SearchNoDataViewDidRefresh {
  248. [self.goodsArr removeAllObjects];
  249. [self requestVoucherFindIsRefresh:YES switchButton:nil];
  250. }
  251. #pragma mark - collectionView
  252. - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
  253. return 2;
  254. }
  255. - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  256. if (section == 1) {
  257. return self.goodsArr.count;
  258. }
  259. return 0;
  260. }
  261. - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
  262. KBChildGoodModel *model = self.goodsArr[indexPath.item];
  263. if (self.cellType == ResultCellTypeVertical) {
  264. KBGoodCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:cellID forIndexPath:indexPath];
  265. cell.model = model;
  266. return cell;
  267. }else {
  268. KBGoodHorzitolCollectionCell *cell = [self.collectionView dequeueReusableCellWithReuseIdentifier:HorzitolCellId forIndexPath:indexPath];
  269. cell.model = model;
  270. return cell;
  271. }
  272. }
  273. - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
  274. KBChildGoodModel *model = self.goodsArr[indexPath.item];
  275. //详情
  276. KBGoodDetailViewController *detailVC = [[KBGoodDetailViewController alloc] init];
  277. DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithChildModel:model];
  278. detailVC.requestModel = requestModel;
  279. KBEventModel *evevtModel = [[KBEventModel alloc] initWithOrigin:model.origin category_id:@"0" source:searchAction];
  280. detailVC.eventModel = evevtModel;
  281. [self.navigationController pushViewController:detailVC animated:YES];
  282. }
  283. - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
  284. UICollectionReusableView *view = nil;
  285. if (indexPath.section == 0) {
  286. if (self.special_search != nil) {
  287. KBSearchSpecialView *searchSpecial =[collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewSpecailHeader forIndexPath:indexPath];
  288. searchSpecial.model = self.adModel;
  289. searchSpecial.tapImgBlock = ^(AdPopModel * _Nonnull model) {
  290. [AdJumpManager jumpToPageWithModel:model ParentViewControll:self];
  291. };
  292. return searchSpecial;
  293. }else {
  294. KBSearchNoDataView *noData = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeaderTop forIndexPath:indexPath];
  295. noData.delegate = self;
  296. noData.hidden = !isNoData;
  297. view = noData;
  298. return view;
  299. }
  300. }
  301. else {
  302. UICollectionReusableView *guessYouLikeView = [collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeaderMiddle forIndexPath:indexPath];
  303. UIImageView *middleImageView = [[UIImageView alloc] initWithFrame:CGRectMake(kScreenWidth/2-FITSIZE(99)/2, FITSIZE(14), FITSIZE(99), FITSIZE(12))];
  304. middleImageView.backgroundColor = [UIColor clearColor];
  305. middleImageView.image = [UIImage imageNamed:@"guess_like_gray"];
  306. guessYouLikeView.clipsToBounds = YES;
  307. [guessYouLikeView addSubview:middleImageView];
  308. view = guessYouLikeView;
  309. }
  310. return view;
  311. }
  312. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
  313. KBChildGoodModel *model = self.goodsArr[indexPath.row];
  314. if (self.cellType == ResultCellTypeVertical) {
  315. CGFloat width = (SCREEN_WIDTH-5)/2;
  316. CGFloat height = width + 102;
  317. CGSize itemSize = CGSizeMake(width, height);
  318. return itemSize;
  319. }else {
  320. return CGSizeMake(SCREEN_WIDTH, 140);
  321. }
  322. }
  323. - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
  324. if (self.cellType == ResultCellTypeVertical) {
  325. return 5;
  326. }else {
  327. return 1;
  328. }
  329. }
  330. - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
  331. if (self.special_search != nil) {
  332. if (section == 0) {
  333. return CGSizeMake(kScreenWidth, FITSIZE(157));
  334. }
  335. else {
  336. return CGSizeMake(kScreenWidth, FITSIZE(40));
  337. }
  338. }
  339. if (isNoData) {
  340. if (section == 0) {
  341. return CGSizeMake(kScreenWidth, FITSIZE(264));
  342. }
  343. else {
  344. return CGSizeMake(kScreenWidth, FITSIZE(40));
  345. }
  346. }
  347. else {
  348. if (section == 0) {
  349. return CGSizeMake(kScreenWidth, 0.1);
  350. }
  351. else {
  352. return CGSizeMake(kScreenWidth, 0.1);
  353. }
  354. }
  355. }
  356. #pragma mark NY_SelectViewDelegate
  357. //筛选确定点击
  358. - (void)filtrateViewMakeSureFromValue:(NSString *)fromValue toValue:(NSString *)toValue {
  359. [self.collectionView scrollToTop];
  360. _minPrice = fromValue;
  361. _maxPrice = toValue;
  362. page = 1;
  363. [self requestVoucherFindIsRefresh:YES switchButton:nil];
  364. }
  365. //仅显示优惠券
  366. - (void)selectItme:(SelectView *)selectView onlyTicketClick:(UIButton *)switchBtn {
  367. _is_has_coupon = switchBtn.selected ? 0 : 1;
  368. [self requestVoucherFindIsRefresh:YES switchButton:switchBtn];
  369. }
  370. //上方条件选择
  371. -(void)selectTopButton:(SelectView *)selectView withIndex:(NSInteger)index withButtonType:(ButtonClickType)type1{
  372. [self.collectionView scrollToTop];
  373. //价格
  374. if (index == 2&&type1) {
  375. switch (type1) {
  376. case ButtonClickTypeNormal:
  377. //正常价格
  378. {
  379. NSLog(@"上边按钮的正常价格");
  380. }
  381. break;
  382. case ButtonClickTypeUp:
  383. //价格升序排列
  384. {
  385. NSLog(@"上边按钮的价格升序排列");
  386. _type = @"3";
  387. }
  388. break;
  389. case ButtonClickTypeDown:
  390. //价格降序排列
  391. {
  392. NSLog(@"上边按钮的价格降序排列");
  393. _type = @"4";
  394. }
  395. break;
  396. default:
  397. break;
  398. }
  399. }else if (index == 0){//综合
  400. NSLog(@"上边按钮的综合");
  401. _type = @"1";
  402. }else if (index == 1){//销量
  403. NSLog(@"上边按钮的销量");
  404. _type = @"2";
  405. }else{//筛选
  406. NSLog(@"上边按钮的筛选");
  407. }
  408. [self requestVoucherFindIsRefresh:YES switchButton:nil];
  409. }
  410. #pragma mark - scrollView
  411. - (void)scrollViewDidScroll:(UIScrollView *)scrollView
  412. {
  413. //scrollView已经有拖拽手势,直接拿到scrollView的拖拽手势
  414. UIPanGestureRecognizer *pan = scrollView.panGestureRecognizer;
  415. //获取到拖拽的速度 >0 向下拖动 <0 向上拖动
  416. CGFloat velocity = [pan velocityInView:scrollView].y;
  417. if (velocity <- 10) {
  418. //向上拖动,隐藏导航栏
  419. [self.navigationController setNavigationBarHidden:YES animated:YES];
  420. if (self.special_search != nil) {
  421. self.collectionView.height = kScreenHeight-KStatusBarHeight;
  422. self.collectionView.y = KStatusBarHeight;
  423. }else {
  424. self.collectionView.height = kScreenHeight-NavBarHeight-selectedViewHeight+NavBarHeight;
  425. self.collectionView.y = self.selectedView.height+KStatusBarHeight;
  426. }
  427. self.selectedView.y = KStatusBarHeight;
  428. }else if (velocity > 10) {
  429. //向下拖动,显示导航栏
  430. [self.navigationController setNavigationBarHidden:NO animated:YES];
  431. if (self.special_search != nil) {
  432. self.collectionView.height = kScreenHeight-NavBarHeight;
  433. self.collectionView.y = 0;
  434. }else {
  435. self.collectionView.height = kScreenHeight-NavBarHeight-selectedViewHeight;
  436. self.collectionView.y = selectedViewHeight;
  437. }
  438. self.selectedView.y = 0;
  439. }else if(velocity == 0){
  440. //停止拖拽
  441. }
  442. }
  443. #pragma mark - lazy
  444. - (UICollectionView *)collectionView {
  445. if (!_collectionView) {
  446. UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
  447. flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
  448. flowLayout.minimumLineSpacing = 5;
  449. flowLayout.minimumInteritemSpacing = 5;
  450. _collectionView = [[KBCollectionView alloc] initWithFrame:CGRectMake(0, selectedViewHeight, kScreenWidth, kScreenHeight-NavBarHeight-selectedViewHeight) collectionViewLayout:flowLayout];
  451. _collectionView.delegate = self;
  452. _collectionView.dataSource = self;
  453. _collectionView.backgroundColor = [UIColor yhGrayColor];
  454. [_collectionView registerClass:[KBGoodCollectionCell class] forCellWithReuseIdentifier:cellID];
  455. [_collectionView registerClass:[KBGoodHorzitolCollectionCell class] forCellWithReuseIdentifier:HorzitolCellId];
  456. //
  457. [_collectionView registerClass:[KBSearchSpecialView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewSpecailHeader];
  458. [_collectionView registerClass:[KBSearchNoDataView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeaderTop];
  459. [_collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:collectionViewHeaderMiddle];
  460. if (@available(iOS 11.0, *)) {
  461. _collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  462. }
  463. }
  464. return _collectionView;
  465. }
  466. - (SelectView *)selectedView {
  467. if (!_selectedView) {
  468. _selectedView = [[SelectView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, selectedViewHeight) withArr:self.filtrateArray];
  469. UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(0, -KStatusBarHeight, SCREEN_WIDTH, KStatusBarHeight)];
  470. bgView.backgroundColor = [UIColor whiteColor];
  471. [_selectedView addSubview:bgView];
  472. _selectedView.delegate = self;
  473. }
  474. return _selectedView;
  475. }
  476. - (NSMutableArray *)goodsArr {
  477. if (!_goodsArr) {
  478. _goodsArr = [NSMutableArray array];
  479. }
  480. return _goodsArr;
  481. }
  482. @end