Commit 2a743b25 authored by Sandy's avatar Sandy

选择采购单checkbox逻辑

parent 525917d1
......@@ -4424,7 +4424,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
name = Debug;
......@@ -4434,8 +4434,8 @@
baseConfigurationReference = 7DDFB1D460448C3B45118195 /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPYING_PRESERVES_HFS_DATA = NO;
ENABLE_BITCODE = NO;
GCC_PREFIX_HEADER = "XFFruit/XFFruit-Prefix.pch";
......@@ -4449,7 +4449,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.gomore.xffruit;
PRODUCT_NAME = XFFruit;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE = "e2cec26c-3666-4512-9b9a-cdb4cd9da56d";
USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**";
};
name = Release;
......
......@@ -19,7 +19,7 @@ typedef NS_ENUM(NSUInteger, CheckBoxBGType) {
@property (assign, nonatomic) BOOL isSelected;
@property (assign, nonatomic) CheckBoxBGType m_eBGType;
@property (nonatomic, copy) void (^blockCheckBox)(BOOL isSelect);
- (void)onCheckBoxAction:(id)sender;
@end
......@@ -92,6 +92,9 @@
#pragma mark - Actions
- (void)onCheckBoxAction:(id)sender {
self.isSelected = !_isSelected;
if (self.blockCheckBox) {
self.blockCheckBox(self.isSelected);
}
}
@end
......@@ -7,7 +7,7 @@
//
#import <UIKit/UIKit.h>
#import "ICRCheckBox.h"
@protocol HeaderCellDelegate <NSObject>
@optional
......@@ -17,8 +17,10 @@
@interface HeaderCell : UIView
@property (nonatomic,weak)id<HeaderCellDelegate>delegate;
@property (strong, nonatomic) ICRCheckBox *checkBox;
@property (nonatomic, copy) void (^blockCheckBox)(BOOL isSelect);
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr;
- (instancetype)initWithFrame:(CGRect)frame withArr:(NSArray *)arr withHiddenEdit:(BOOL)isHiddenEdit;
- (instancetype)initWithFrame:(CGRect)frame WithCheckBoxArr:(NSArray *)arr checkBox:(void (^)(BOOL isSelect))check;
@end
......@@ -11,6 +11,7 @@
#define LeftWidth 45
#define RightWidth 30
#define SpaceMargin 1
#import "ICRCheckBox.h"
@interface HeaderCell ()
@property (nonatomic,strong)NSArray *arr;
@property (nonatomic,strong)UILabel *lineLabel;
......@@ -38,6 +39,18 @@
return self;
}
- (instancetype)initWithFrame:(CGRect)frame WithCheckBoxArr:(NSArray *)arr checkBox:(void (^)(BOOL isSelect))check {
self = [super initWithFrame:frame];
if (self) {
self.arr = arr;
self.isHiddenAdd = YES;
self.blockCheckBox = check;
[self bulidLayout];
[self uiAddCheckBox];
}
return self;
}
- (void)bulidLayout{
CGFloat headWidth = (ScreenSize.width - LeftWidth - LeftWidth - SpaceMargin* (self.arr.count -1))/self.arr.count;
......@@ -65,6 +78,23 @@
[self addSubview:addBtn];
}
}
- (void)uiAddCheckBox {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(ScreenSize.width - 30, 0, 30, self.frame.size.height)];
label.text = @"全选";
label.font = [UIFont systemFontOfSize:13];
[self addSubview:label];
ICRCheckBox *addBtn = [[ICRCheckBox alloc] initWithFrame:CGRectMake(ScreenSize.width - LeftWidth - SpaceMargin - 15, 0, LeftWidth, self.frame.size.height)];
self.checkBox = addBtn;
addBtn.m_eBGType = kCheckBoxBGGray;
addBtn.blockCheckBox = self.blockCheckBox;
[self addSubview:addBtn];
}
- (void)addBtn{
......
......@@ -12,7 +12,9 @@
#define TableHeight 44
#define ShowHeight 110
@interface TransportPurchaseCell ()
@property (strong, nonatomic) HeaderCell *headCell;
@end
@implementation TransportPurchaseCell
......@@ -58,8 +60,15 @@
[self.bgView addSubview:self.secondTable];
NSArray *arr = @[@"商品",@"包装规格",@"包装数量",@"基础数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:YES];
self.secondTable.tableHeaderView = headCell;
__weak TransportPurchaseCell *weakSelf = self;
self.headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) WithCheckBoxArr:arr checkBox:^(BOOL isSelect) {
[weakSelf.selectArr removeAllObjects];
if (isSelect) {
[weakSelf.selectArr addObjectsFromArray:self.secondArr];
}
[weakSelf.secondTable reloadData];
}];
self.secondTable.tableHeaderView = self.headCell;
}
......@@ -99,6 +108,8 @@
{
static NSString *cellID = @"TransportPurductCell";
TransportPurductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
cell.editBtn.enabled = NO;
self.headCell.checkBox.isSelected = self.selectArr.count == self.secondArr.count;
if (cell == nil) {
cell = [[TransportPurductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID withImageName:@"selected"];
cell.editBtn.hidden = YES;
......@@ -156,6 +167,7 @@
// cell.backgroundColor = [UIColor whiteColor];
// [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_getSelectPurchaseProduct object:nil userInfo:@{@"selectArr":billProduct,@"state":@"remove"}];
}
self.headCell.checkBox.isSelected = self.selectArr.count == self.secondArr.count;
[self.secondTable reloadData];
}
- (BOOL)isHaveIndexPath:(TransportPdtDetail *)billProduct{
......
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