From 02d5ce9e2d6a8a726ae101ab68ef0b606f41b996 Mon Sep 17 00:00:00 2001 From: 重庆迈尖科技有限公司 Date: 星期二, 14 八月 2018 09:40:53 +0800 Subject: [PATCH] Merge branch 'master' of ssh://193.112.35.168:29418/fanliquan --- MIduo/数据/lib/ZYSideSlipFilter/ZYSideSlipFilter/Classes/Controller/ZYSideSlipFilterController.m | 71 +++++++++++++++++++++-------------- 1 files changed, 43 insertions(+), 28 deletions(-) diff --git "a/MIduo/\346\225\260\346\215\256/lib/ZYSideSlipFilter/ZYSideSlipFilter/Classes/Controller/ZYSideSlipFilterController.m" "b/MIduo/\346\225\260\346\215\256/lib/ZYSideSlipFilter/ZYSideSlipFilter/Classes/Controller/ZYSideSlipFilterController.m" index 9747dae..3fdfda9 100755 --- "a/MIduo/\346\225\260\346\215\256/lib/ZYSideSlipFilter/ZYSideSlipFilter/Classes/Controller/ZYSideSlipFilterController.m" +++ "b/MIduo/\346\225\260\346\215\256/lib/ZYSideSlipFilter/ZYSideSlipFilter/Classes/Controller/ZYSideSlipFilterController.m" @@ -13,9 +13,7 @@ #import "ZYSideSlipFilterConfig.h" #import "UIColor+hexColor.h" #import "objc/runtime.h" - -#define SCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width -#define SCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height +#import "Algorithm.h" #define WIDTH KScreenW * (1 - 0.15) #define SLIP_ORIGIN_FRAME CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH - _sideSlipLeading, SCREEN_HEIGHT) @@ -40,7 +38,7 @@ @implementation ZYSideSlipFilterController - (instancetype)initWithSponsor:(UIViewController *)sponsor - resetBlock:(SideSlipFilterResetBlock)resetBlock + resetBlock:(SideSlipFilterResetBlock)resetBlock commitBlock:(SideSlipFilterCommitBlock)commitBlock { self = [super init]; if (self) { @@ -70,18 +68,18 @@ [self.view addSubview:self.mainTableView]; [self.view addSubview:bottomView]; -// -// NSDictionary *views = @{@"mainTableView":self.mainTableView, @"bottomView":bottomView}; -// bottomView.frame = CGRectMake(0, KScreenH - 100, self.view.frame.size.width, 40); -// -// if (IsiPhoneX) { -// [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bottomView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:50]]; -// }else{ -// [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bottomView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:BOTTOM_BUTTON_HEIGHT]]; -// } -// [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[mainTableView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; -// [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bottomView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; -// [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[mainTableView][bottomView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; + // + // NSDictionary *views = @{@"mainTableView":self.mainTableView, @"bottomView":bottomView}; + // bottomView.frame = CGRectMake(0, KScreenH - 100, self.view.frame.size.width, 40); + // + // if (IsiPhoneX) { + // [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bottomView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:50]]; + // }else{ + // [self.view addConstraint:[NSLayoutConstraint constraintWithItem:bottomView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.f constant:BOTTOM_BUTTON_HEIGHT]]; + // } + // [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[mainTableView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; + // [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[bottomView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; + // [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[mainTableView][bottomView]|" options:NSLayoutFormatAlignAllCenterX metrics:nil views:views]]; } - (void)configureStatic { @@ -141,7 +139,7 @@ } - (UIView *)createBottomView { UIView *bottomView = [[UIView alloc] init]; -// double width = ; + // double width = ; [bottomView setTranslatesAutoresizingMaskIntoConstraints:NO]; CGFloat height = 60; if (IsiPhoneX) { @@ -150,14 +148,14 @@ bottomView.frame = CGRectMake(0, self.view.frame.size.height - height, WIDTH, height - 20); bottomView.backgroundColor = [UIColor whiteColor]; //resetButton -// bottomView. - + // bottomView. + UIButton *resetButton = [[UIButton alloc] init]; resetButton.frame = CGRectMake(0, 0,WIDTH / 2, bottomView.frame.size.height ); if (IsiPhoneX) { resetButton.frame = CGRectMake(0, 0,WIDTH / 2, bottomView.frame.size.height - 40 ); } -// [resetButton setTranslatesAutoresizingMaskIntoConstraints:NO]; + // [resetButton setTranslatesAutoresizingMaskIntoConstraints:NO]; [resetButton addTarget:self action:@selector(clickResetButton:) forControlEvents:UIControlEventTouchUpInside]; [resetButton.titleLabel setFont:[UIFont systemFontOfSize:BOTTOM_BUTTON_FONT_SIZE]]; [resetButton setTitleColor:[UIColor hexColor:FILTER_BLACK_STRING] forState:UIControlStateNormal]; @@ -165,15 +163,15 @@ if ([resetString isEqualToString:@"sZYFilterReset"]) { resetString = @"閲嶇疆"; } - + [resetButton setTitle:resetString forState:UIControlStateNormal]; [resetButton setBackgroundColor:[UIColor whiteColor]]; [bottomView addSubview:resetButton]; //commitButton UIButton *commitButton = [[UIButton alloc] init]; commitButton.frame = CGRectMake(CGRectGetMaxX(resetButton.frame), 0, WIDTH / 2, resetButton.frame.size.height); - -// [commitButton setTranslatesAutoresizingMaskIntoConstraints:NO]; + + // [commitButton setTranslatesAutoresizingMaskIntoConstraints:NO]; [commitButton addTarget:self action:@selector(clickCommitButton:) forControlEvents:UIControlEventTouchUpInside]; [commitButton.titleLabel setFont:[UIFont systemFontOfSize:BOTTOM_BUTTON_FONT_SIZE]]; [commitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; @@ -185,16 +183,20 @@ [commitButton setBackgroundColor:XYRMainColor]; [bottomView addSubview:commitButton]; //constraints -// NSDictionary *views = NSDictionaryOfVariableBindings(resetButton, commitButton); -// [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[resetButton][commitButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; -// [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[resetButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; -// [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[commitButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; -// [bottomView addConstraint:[NSLayoutConstraint constraintWithItem:resetButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:commitButton attribute:NSLayoutAttributeWidth multiplier:1.f constant:0.f]]; + // NSDictionary *views = NSDictionaryOfVariableBindings(resetButton, commitButton); + // [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[resetButton][commitButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; + // [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[resetButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; + // [bottomView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[commitButton]|" options:NSLayoutFormatAlignAllCenterY metrics:nil views:views]]; + // [bottomView addConstraint:[NSLayoutConstraint constraintWithItem:resetButton attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:commitButton attribute:NSLayoutAttributeWidth multiplier:1.f constant:0.f]]; return bottomView; } - (void)clickResetButton:(id)sender { + + [ZYSideSlipFilterManger shareinstance].minPrice = nil; + [ZYSideSlipFilterManger shareinstance].maxPrice = nil; + _resetBlock(_dataList); [[NSNotificationCenter defaultCenter] postNotificationName:FILTER_NOTIFICATION_NAME_DID_RESET_DATA object:nil]; [_mainTableView reloadData]; @@ -203,6 +205,19 @@ - (void)clickCommitButton:(id)sender { _commitBlock(_dataList); [[NSNotificationCenter defaultCenter] postNotificationName:FILTER_NOTIFICATION_NAME_DID_COMMIT_DATA object:nil]; + + if ([ZYSideSlipFilterManger shareinstance].minPrice != 0 && [ZYSideSlipFilterManger shareinstance].maxPrice.length != 0) { + + NSString *result = [Algorithm compareSize:[ZYSideSlipFilterManger shareinstance].minPrice count2:[ZYSideSlipFilterManger shareinstance].maxPrice]; + + if ([result isEqualToString:@"澶т簬"]) { + + NSString *temp = [ZYSideSlipFilterManger shareinstance].minPrice; + [ZYSideSlipFilterManger shareinstance].minPrice = [ZYSideSlipFilterManger shareinstance].maxPrice; + [ZYSideSlipFilterManger shareinstance].maxPrice = temp; + } + } + } - (void)clickBackCover:(id)sender { -- Gitblit v1.8.0