Commit d15cff48 authored by admin's avatar admin

保存状态

parent 50b06048
......@@ -8,9 +8,10 @@
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "AreaModel.h"
@interface SelectAreaTableCell : UITableViewCell
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) AreaModel *areaModel;
@end
......@@ -15,7 +15,7 @@
if (!_checkBoxButton) {
_checkBoxButton = [[CheckBoxButton alloc] init];
[_checkBoxButton setTitleColor:kLightBlack forState:UIControlStateNormal];
[_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
// [_checkBoxButton setTitleColor:kSelectStoreColor forState:UIControlStateSelected];
_checkBoxButton.titleLabel.font = [UIFont systemFontOfSize:17.0];
_checkBoxButton.translatesAutoresizingMaskIntoConstraints = NO;
[_checkBoxButton setImage:[UIImage imageNamed:@"uncheck_box"] forState:UIControlStateNormal];
......@@ -24,7 +24,6 @@
_checkBoxButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
_checkBoxButton.imageView.contentMode = UIViewContentModeRight;
_checkBoxButton.titleLabel.contentMode = UIViewContentModeLeft;
[_checkBoxButton addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
[self.contentView addSubview:_checkBoxButton];
// 顶端
......@@ -45,10 +44,7 @@
}
return _checkBoxButton;
}
- (void)click:(CheckBoxButton *)sender
{
sender.selected = !sender.selected;
}
- (UIImageView *)iconImageView
{
......
......@@ -8,8 +8,11 @@
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "ProvinceModel.h"
@interface SelectProvinceTableCell : UITableViewCell
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) ProvinceModel *provinceModel;
@end
......@@ -8,11 +8,12 @@
#import <UIKit/UIKit.h>
#import "CheckBoxButton.h"
#import "StoreModel.h"
@interface SelectStoreTableCell : UITableViewCell
//@property (nonatomic, strong) UIButton *storeButton1;
//@property (nonatomic, strong) UIButton *storeButton2;
@property (nonatomic, strong) CheckBoxButton *checkBoxButton;
@property (nonatomic, strong) StoreModel *storeModel;
@end
......@@ -22,6 +22,7 @@
#import "StoreModel.h"
#import "SelectStoreHeadView.h"
#import "CheckBoxButton.h"
@interface SelectStoreViewController () <RATreeViewDelegate, RATreeViewDataSource>
@property (nonatomic, strong) RATreeView *treeView;
......@@ -106,6 +107,27 @@
}
- (void)areaClick:(CheckBoxButton *)sender
{
sender.selected = !sender.selected;
SelectAreaTableCell *cell = (SelectAreaTableCell *)sender.superview.superview;
NSArray *provinceArray = cell.areaModel.provinceArray;
if (sender.selected) {
for (ProvinceModel *proVin in provinceArray) {
proVin.isChoose = YES;
}
[sender setTitleColor:kLightBlack forState:UIControlStateNormal];
} else {
for (ProvinceModel *proVin in provinceArray) {
proVin.isChoose = NO;
}
[sender setTitleColor:kSelectStoreColor forState:UIControlStateNormal];
}
[_treeView reloadRows];
}
#pragma mark - RAtreeView Delegate/DataSource
- (NSInteger)treeView:(RATreeView *)treeView numberOfChildrenOfItem:(id)item
......@@ -147,21 +169,31 @@
if (level == 0) {
AreaModel *data = item;
SelectAreaTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectAreaTableCell];
cell.areaModel = data;
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
NSLog(@"check.select = %d", (int)cell.checkBoxButton.selected);
[cell.checkBoxButton addTarget:self action:@selector(areaClick:) forControlEvents:UIControlEventTouchUpInside];
cell.iconImageView.image = [UIImage imageNamed:@"arrow_down"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else if (level == 1) {
ProvinceModel *data = item;
SelectProvinceTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectProvinceTableCell];
cell.provinceModel = data;
if (data.isChoose) {
cell.checkBoxButton.selected = YES;
} else {
cell.checkBoxButton.selected = NO;
}
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
cell.iconImageView.image = [UIImage imageNamed:@"grey-trilateral_down"];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
StoreModel *data = item;
SelectStoreTableCell *cell = [self.treeView dequeueReusableCellWithIdentifier:kSelectStoreTableCell];
cell.storeModel = data;
[cell.checkBoxButton setTitle:data.name forState:UIControlStateNormal];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......
......@@ -121,6 +121,9 @@
__block RankingListViewController *weakSelf = self;
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......
......@@ -226,6 +226,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
__block HomeViewController *weakSelf = self;
[httpCilent1 getRankingListWithParameters:parameters1 completion:^(id response, NSError *error) {
NSLog(@"刷新!! = 口碑排名response = %@", response);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -298,6 +301,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSLog(@"error = %@", error);
if ([(NSArray *)response[@"data"] count] == 0) {
return;
}
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
......@@ -310,7 +316,9 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
_allRankListArray = (NSMutableArray *)[self sortRankListWithRankListArray:tgArray];
[self.tableView reloadData];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment