|
|
@@ -10,10 +10,18 @@
|
|
|
|
|
|
@interface shareRecordViewController ()<UITableViewDelegate,UITableViewDataSource,DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
|
|
|
{
|
|
|
+ BOOL isEditType;
|
|
|
}
|
|
|
|
|
|
@property (nonatomic, strong) UITableView *tableView;
|
|
|
+@property (nonatomic, strong) UIButton *ruleBottomButton;
|
|
|
|
|
|
+@property (nonatomic, strong) UIButton *delRuleButton;
|
|
|
+@property (nonatomic, strong) UIButton *cancelShareButton;
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIButton *rightEditButton;
|
|
|
+@property (nonatomic, strong) UIButton *leftCancleButton;
|
|
|
+@property (nonatomic, strong) UIButton *rightSelectAllButton;
|
|
|
@end
|
|
|
|
|
|
@implementation shareRecordViewController
|
|
|
@@ -34,6 +42,8 @@
|
|
|
|
|
|
- (void)drawAnyView{
|
|
|
|
|
|
+ [self initNavHeadUIFun];
|
|
|
+
|
|
|
[self.view addSubview:self.tableView];
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.mas_equalTo(0);
|
|
|
@@ -41,6 +51,130 @@
|
|
|
make.bottom.mas_equalTo(-(60 + safeArea));
|
|
|
make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
|
|
|
}];
|
|
|
+
|
|
|
+ _ruleBottomButton = [[UIButton alloc] init];
|
|
|
+ [_ruleBottomButton setTitle:NSLocalizedString(@"share_rule_but_title",nil) forState:UIControlStateNormal];
|
|
|
+ [_ruleBottomButton setTitleColor:HW0A132BColor forState:UIControlStateNormal];
|
|
|
+ _ruleBottomButton.titleLabel.font = [UIFont boldSystemFontOfSize:14.0];
|
|
|
+ [_ruleBottomButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _ruleBottomButton.tag = 1;
|
|
|
+ [self.view addSubview:_ruleBottomButton];
|
|
|
+ _ruleBottomButton.layer.cornerRadius = 8;
|
|
|
+ _ruleBottomButton.layer.masksToBounds = YES;
|
|
|
+ _ruleBottomButton.backgroundColor = [UIColor whiteColor];
|
|
|
+
|
|
|
+ [_ruleBottomButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.bottom.mas_equalTo(-(safeArea));
|
|
|
+ make.height.mas_equalTo(48);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ _delRuleButton = [[UIButton alloc] init];
|
|
|
+ [_delRuleButton setTitle:NSLocalizedString(@"share_del_record",nil) forState:UIControlStateNormal];
|
|
|
+ [_delRuleButton setTitleColor:HW0A132BColor forState:UIControlStateNormal];
|
|
|
+ _delRuleButton.titleLabel.font = [UIFont boldSystemFontOfSize:14.0];
|
|
|
+ [_delRuleButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _delRuleButton.tag = 10;
|
|
|
+ [self.view addSubview:_delRuleButton];
|
|
|
+ _delRuleButton.layer.cornerRadius = 8;
|
|
|
+ _delRuleButton.layer.masksToBounds = YES;
|
|
|
+ _delRuleButton.backgroundColor = [UIColor hwColor:@"#E3E8F1"];
|
|
|
+ _delRuleButton.hidden = YES;
|
|
|
+
|
|
|
+ [_delRuleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.equalTo(self.view.mas_centerX).offset(-10);
|
|
|
+ make.bottom.mas_equalTo(-(safeArea));
|
|
|
+ make.height.mas_equalTo(48);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ _cancelShareButton = [[UIButton alloc] init];
|
|
|
+ CGFloat w_btn = SCREEN_W/2.0 -15 -10;
|
|
|
+
|
|
|
+ // gradient
|
|
|
+ CAGradientLayer *gl = [CAGradientLayer layer];
|
|
|
+ gl.frame = CGRectMake(0,0,w_btn,48.f);
|
|
|
+ gl.startPoint = CGPointMake(0, 0.5);
|
|
|
+ gl.endPoint = CGPointMake(1, 0.5);
|
|
|
+ gl.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
|
|
|
+ gl.locations = @[@(0), @(1.0f)];
|
|
|
+
|
|
|
+ [_cancelShareButton.layer addSublayer:gl];
|
|
|
+ [_cancelShareButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)];
|
|
|
+ [_cancelShareButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:(UIControlEventTouchUpInside)];
|
|
|
+ [_cancelShareButton setTitle:NSLocalizedString(@"cancel_share_title",nil) forState:(UIControlStateNormal)];
|
|
|
+ [_cancelShareButton.titleLabel setFont:[UIFont systemFontOfSize:14.f]];
|
|
|
+ [_cancelShareButton.layer setCornerRadius:8.f];
|
|
|
+ _cancelShareButton.clipsToBounds = YES;
|
|
|
+ _cancelShareButton.tag = 11;
|
|
|
+
|
|
|
+ [self.view addSubview:_cancelShareButton];
|
|
|
+ _cancelShareButton.hidden = YES;
|
|
|
+
|
|
|
+ [_cancelShareButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.left.equalTo(self.view.mas_centerX).offset(10);
|
|
|
+ make.bottom.mas_equalTo(-(safeArea));
|
|
|
+ make.height.mas_equalTo(48);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)initNavHeadUIFun
|
|
|
+{
|
|
|
+ _rightEditButton = [[UIButton alloc] init];
|
|
|
+ [_rightEditButton setTitle:NSLocalizedString(@"edit_common",nil) forState:UIControlStateNormal];
|
|
|
+ _rightEditButton.tag = 2;
|
|
|
+ [_rightEditButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
|
|
|
+ _rightEditButton.titleLabel.font = [UIFont systemFontOfSize:16.0];
|
|
|
+ _rightEditButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
|
|
|
+ [_rightEditButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [self.navBarBGView addSubview:_rightEditButton];
|
|
|
+
|
|
|
+ [_rightEditButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(80);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ _leftCancleButton = [[UIButton alloc] init];
|
|
|
+ [_leftCancleButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
|
|
|
+ _leftCancleButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
|
|
|
+ _leftCancleButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
|
|
+ [_leftCancleButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _leftCancleButton.tag = 3;
|
|
|
+ [_leftCancleButton setTitle:NSLocalizedString(@"other_cancel",nil) forState:UIControlStateNormal];
|
|
|
+ [self.navBarBGView addSubview:_leftCancleButton];
|
|
|
+ _leftCancleButton.hidden = YES;
|
|
|
+
|
|
|
+ [_leftCancleButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(80);
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
+ make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
|
|
|
+ }];
|
|
|
+
|
|
|
+ _rightSelectAllButton = [[UIButton alloc] init];
|
|
|
+ [_rightSelectAllButton setImage:[UIImage imageNamed:@"edit_select_all_h"] forState:UIControlStateSelected];
|
|
|
+ [_rightSelectAllButton setImage:[UIImage imageNamed:@"edit_select_all_n"] forState:UIControlStateNormal];
|
|
|
+ [_rightSelectAllButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _rightSelectAllButton.tag = 4;
|
|
|
+ [self.navBarBGView addSubview:_rightSelectAllButton];
|
|
|
+ _rightSelectAllButton.hidden = YES;
|
|
|
+
|
|
|
+ [_rightSelectAllButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.mas_equalTo(80);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
+ make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
|
|
|
+ }];
|
|
|
}
|
|
|
|
|
|
#pragma mark - 懒加载
|
|
|
@@ -95,6 +229,8 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ cell.isEditType = isEditType;
|
|
|
+
|
|
|
// if(row < _curCouldPhoneFileListMod.data.list.count){
|
|
|
// couldPhoneFileModel* fileModel = _curCouldPhoneFileListMod.data.list[row];
|
|
|
// cell.curFileModel = fileModel;
|
|
|
@@ -113,6 +249,8 @@
|
|
|
return 70;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
#pragma mark 空数据
|
|
|
- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {
|
|
|
|
|
|
@@ -122,7 +260,7 @@
|
|
|
}
|
|
|
|
|
|
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {
|
|
|
- NSString *text = NSLocalizedString(@"File_download_file_no_data",nil);
|
|
|
+ NSString *text = NSLocalizedString(@"common_no_data_pic",nil);
|
|
|
|
|
|
NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:16.0f],
|
|
|
NSForegroundColorAttributeName: HW999999Color};
|
|
|
@@ -135,5 +273,61 @@
|
|
|
return -150;
|
|
|
}
|
|
|
|
|
|
+- (void)didClickButtonFun:(UIButton*)but
|
|
|
+{
|
|
|
+ NSInteger tag = but.tag;
|
|
|
+
|
|
|
+ if(tag == 1){
|
|
|
+ [[iToast makeText:@"分享规则"] show];
|
|
|
+ }
|
|
|
+ else if(tag == 2){
|
|
|
+ [self setEditTypeFun];
|
|
|
+ }
|
|
|
+ else if(tag == 3){
|
|
|
+ [self cancelEditTypeFun];
|
|
|
+ }
|
|
|
+ else if(tag == 4){
|
|
|
+ but.selected = !but.selected;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 进入编辑
|
|
|
+- (void)setEditTypeFun
|
|
|
+{
|
|
|
+ isEditType = YES;
|
|
|
+ _rightEditButton.hidden = YES;
|
|
|
+ _ruleBottomButton.hidden = YES;
|
|
|
+ self.backBtn.hidden = YES;
|
|
|
+
|
|
|
+ _leftCancleButton.hidden = NO;
|
|
|
+ _rightSelectAllButton.hidden = NO;
|
|
|
+
|
|
|
+ _delRuleButton.hidden = NO;
|
|
|
+ _delRuleButton.userInteractionEnabled = NO;
|
|
|
+// [_delRuleButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:0.5] forState:UIControlStateNormal];
|
|
|
+// _delRuleButton.backgroundColor = [UIColor hwColor:@"#E3E8F1" alpha:0.5];
|
|
|
+ _delRuleButton.alpha = 0.5;
|
|
|
+
|
|
|
+ _cancelShareButton.hidden = NO;
|
|
|
+ _cancelShareButton.userInteractionEnabled = NO;
|
|
|
+ _cancelShareButton.alpha = 0.5;
|
|
|
+
|
|
|
+ [self.tableView reloadData];
|
|
|
+}
|
|
|
|
|
|
+#pragma mark 取消编辑
|
|
|
+- (void)cancelEditTypeFun
|
|
|
+{
|
|
|
+ isEditType = NO;
|
|
|
+ _rightEditButton.hidden = NO;
|
|
|
+ _ruleBottomButton.hidden = NO;
|
|
|
+ self.backBtn.hidden = NO;
|
|
|
+
|
|
|
+ _leftCancleButton.hidden = YES;
|
|
|
+ _rightSelectAllButton.hidden = YES;
|
|
|
+ _delRuleButton.hidden = YES;
|
|
|
+ _cancelShareButton.hidden = YES;
|
|
|
+ [self.tableView reloadData];
|
|
|
+}
|
|
|
@end
|