|
@@ -0,0 +1,372 @@
|
|
|
+//
|
|
|
+// filePathCreatPopView.m
|
|
|
+// 隐私保护
|
|
|
+//
|
|
|
+// Created by xd h on 2023/12/29.
|
|
|
+//
|
|
|
+
|
|
|
+#import "filePathCreatPopView.h"
|
|
|
+#import "filePathCreatTableViewCell.h"
|
|
|
+
|
|
|
+
|
|
|
+@interface filePathCreatPopView ()<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>
|
|
|
+{
|
|
|
+ UIView *whiteBgView;
|
|
|
+ UITextField *filePathNameTF;
|
|
|
+
|
|
|
+ UIButton *canclButton;
|
|
|
+ UIButton *okButton;
|
|
|
+}
|
|
|
+
|
|
|
+@property (nonatomic, strong) UITableView *tableView;
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation filePathCreatPopView
|
|
|
+
|
|
|
+- (id)initWithFrame:(CGRect)frame{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+
|
|
|
+ [self drawAnyView];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+- (void)drawAnyView{
|
|
|
+ [self setBackgroundColor:[UIColor hwColor:@"#000000" alpha:0.6]];
|
|
|
+
|
|
|
+ whiteBgView = [[UIView alloc] init];
|
|
|
+ whiteBgView.backgroundColor = [UIColor whiteColor];
|
|
|
+ whiteBgView.layer.cornerRadius = 12;
|
|
|
+ [self addSubview:whiteBgView];
|
|
|
+
|
|
|
+ [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(418+ 10 + safeArea);
|
|
|
+ make.bottom.mas_equalTo(10);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIView *tapView = [[UIView alloc] init];
|
|
|
+ [self addSubview:tapView];
|
|
|
+
|
|
|
+// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapUpFun:)];
|
|
|
+// [tapView addGestureRecognizer:tap];
|
|
|
+
|
|
|
+ [tapView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.top.mas_equalTo(0);
|
|
|
+ make.bottom.mas_equalTo(whiteBgView.mas_top);
|
|
|
+ }];
|
|
|
+
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
+ titleLabel.text = NSLocalizedString(@"File_upload_path_new",nil);
|
|
|
+ titleLabel.font = [UIFont boldSystemFontOfSize:18.0];
|
|
|
+ titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
+ [whiteBgView addSubview:titleLabel];
|
|
|
+
|
|
|
+ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.top.mas_equalTo(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [whiteBgView addSubview:self.tableView];
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.height.mas_equalTo(70*2+50);
|
|
|
+ make.top.equalTo(titleLabel.mas_bottom).offset(15.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ UILabel *tipLabel = [[UILabel alloc] init];
|
|
|
+ tipLabel.text = NSLocalizedString(@"File_upload_path_new_name_tip",nil);
|
|
|
+ tipLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ tipLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
+ [whiteBgView addSubview:tipLabel];
|
|
|
+
|
|
|
+ [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(0);
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.top.equalTo(self.tableView.mas_bottom).offset(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+ filePathNameTF = [[UITextField alloc] init];
|
|
|
+ filePathNameTF.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
|
|
|
+ filePathNameTF.layer.cornerRadius = 8;
|
|
|
+ filePathNameTF.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ filePathNameTF.placeholder = NSLocalizedString(@"File_upload_path_new_input_tip",nil);
|
|
|
+ filePathNameTF.delegate = self;
|
|
|
+ filePathNameTF.returnKeyType = UIReturnKeyDone;
|
|
|
+ [whiteBgView addSubview:filePathNameTF];
|
|
|
+ [filePathNameTF setTintColor:[UIColor hwColor:@"#01B7EA" alpha:1.0]];
|
|
|
+
|
|
|
+ UIView *leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, 1)];
|
|
|
+ filePathNameTF.leftView = leftView;
|
|
|
+ filePathNameTF.leftViewMode = UITextFieldViewModeAlways;
|
|
|
+
|
|
|
+ [filePathNameTF mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.height.mas_equalTo(48);
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.top.equalTo(tipLabel.mas_bottom).offset(15);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ canclButton = [[UIButton alloc] init];
|
|
|
+ [canclButton setTitle:NSLocalizedString(@"other_cancel",nil) forState:UIControlStateNormal];
|
|
|
+ [canclButton setTitleColor:[UIColor hwColor:@"#0A132B" alpha:1.0] forState:UIControlStateNormal];
|
|
|
+ canclButton.backgroundColor = [UIColor hwColor:@"#E3E8F1" alpha:1.0];
|
|
|
+ canclButton.layer.cornerRadius = 8;
|
|
|
+ canclButton.tag = 1;
|
|
|
+ [canclButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [whiteBgView addSubview:canclButton];
|
|
|
+
|
|
|
+ [canclButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15.0);
|
|
|
+ make.right.equalTo(whiteBgView.mas_centerX).offset(-10);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ make.bottom.mas_equalTo(-safeArea -10);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+ okButton = [[UIButton alloc] init];
|
|
|
+ okButton.tag = 2;
|
|
|
+ [okButton setTitle:NSLocalizedString(@"other_comment_ok",nil) forState:UIControlStateNormal];
|
|
|
+ okButton.titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
|
|
|
+ okButton.layer.cornerRadius = 8;
|
|
|
+ okButton.layer.masksToBounds = YES;
|
|
|
+ [okButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ [whiteBgView addSubview:okButton];
|
|
|
+
|
|
|
+ // gradient
|
|
|
+ CAGradientLayer* _glayer = [CAGradientLayer layer];
|
|
|
+ _glayer.startPoint = CGPointMake(0, 0.5);
|
|
|
+ _glayer.endPoint = CGPointMake(1, 0.5);
|
|
|
+ _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0BDDFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#048CFB" alpha:1.0].CGColor];
|
|
|
+ _glayer.locations = @[@(0), @(1.0f)];
|
|
|
+ [okButton.layer insertSublayer:_glayer atIndex:0];
|
|
|
+
|
|
|
+ CGRect frame = CGRectMake(0, 0, SCREEN_W/2.0, 40);
|
|
|
+ _glayer.frame = frame;
|
|
|
+
|
|
|
+ [okButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.mas_equalTo(-15.0);
|
|
|
+ make.left.equalTo(whiteBgView.mas_centerX).offset(10);
|
|
|
+ make.height.mas_equalTo(40);
|
|
|
+ make.bottom.mas_equalTo(-safeArea -10);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - 懒加载
|
|
|
+- (UITableView *)tableView{
|
|
|
+ if (!_tableView) {
|
|
|
+ _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 0, 0) style:UITableViewStylePlain];
|
|
|
+ _tableView.delegate = self;
|
|
|
+ _tableView.dataSource = self;
|
|
|
+ _tableView.showsVerticalScrollIndicator = NO;
|
|
|
+ _tableView.showsHorizontalScrollIndicator = NO;
|
|
|
+// _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
|
|
|
+ [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
|
|
|
+ [_tableView setSeparatorColor:[UIColor clearColor]];
|
|
|
+ [_tableView setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [_tableView setTableFooterView:[UIView new]];
|
|
|
+ [_tableView setBounces:YES];
|
|
|
+ _tableView.backgroundColor = [UIColor hwColor:@"#F9F9F9" alpha:1.0];
|
|
|
+ _tableView.layer.cornerRadius = 8;
|
|
|
+ _tableView.scrollEnabled = NO;
|
|
|
+ if (@available(iOS 15.0, *)) {
|
|
|
+ _tableView.sectionHeaderTopPadding = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return _tableView;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+#pragma mark - 列表委托
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
|
|
+ return 1;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+ return 2;
|
|
|
+}
|
|
|
+
|
|
|
+- (filePathCreatTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+
|
|
|
+ __block NSInteger row = indexPath.row;
|
|
|
+ static NSString *identifier = @"filePathCreatTableViewCell";
|
|
|
+
|
|
|
+ filePathCreatTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
|
|
+ cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
|
|
+ if (!cell){
|
|
|
+ cell = [[filePathCreatTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
|
|
|
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
|
|
|
+ [cell setBackgroundColor:[UIColor clearColor]];
|
|
|
+ [cell setAccessoryType:(UITableViewCellAccessoryNone)];
|
|
|
+
|
|
|
+ [cell.bgViewLayer removeFromSuperlayer];
|
|
|
+ [cell.titleLabel2 setHidden:NO];
|
|
|
+ [cell.rightImage setHidden:YES];
|
|
|
+ [cell.lineView setHidden:YES];
|
|
|
+ [cell.checkButton setHidden:NO];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if (row == 0){
|
|
|
+ //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
|
|
|
+ cell.titleLabel.text = @"云机系统名称";
|
|
|
+
|
|
|
+ cell.checkButton.selected = YES;
|
|
|
+
|
|
|
+ }else if (row == 1){
|
|
|
+ //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
|
|
|
+
|
|
|
+ cell.titleLabel.text = @"云机系统名称";
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ KWeakSelf
|
|
|
+ cell.didClickSwitch = ^(BOOL SwitchOn) {
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
+ return 70;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
|
|
|
+{
|
|
|
+ return 40.0;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
|
|
|
+{
|
|
|
+ UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, 40)];
|
|
|
+ //headView.backgroundColor = [UIColor greenColor];
|
|
|
+
|
|
|
+ UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
+ titleLabel.text = NSLocalizedString(@"File_upload_path_new_check_tip",nil);
|
|
|
+ titleLabel.font = [UIFont systemFontOfSize:14.0];
|
|
|
+ titleLabel.textColor = [UIColor hwColor:@"#0A132B" alpha:1.0];
|
|
|
+ [headView addSubview:titleLabel];
|
|
|
+
|
|
|
+ [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(15);
|
|
|
+ make.right.mas_equalTo(-15);
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.top.mas_equalTo(10);
|
|
|
+ }];
|
|
|
+
|
|
|
+ return headView;
|
|
|
+}
|
|
|
+
|
|
|
+//- (void)setFileTransferType:(NSInteger)fileTransferType
|
|
|
+//{
|
|
|
+// _fileTransferType = fileTransferType;
|
|
|
+//
|
|
|
+// NSString *uploadTitle = NSLocalizedString(@"File_upload_type_image",nil);
|
|
|
+// NSString *uploadTip = NSLocalizedString(@"File_upload_type_tip",nil);
|
|
|
+//
|
|
|
+// NSString *downloadTitle = NSLocalizedString(@"File_down_type_image",nil);
|
|
|
+// NSString *downloadTip = NSLocalizedString(@"File_down_type_tip",nil);
|
|
|
+//
|
|
|
+// if(fileTransferType == 2)
|
|
|
+// {
|
|
|
+// uploadTitle = NSLocalizedString(@"File_upload_type_video",nil);
|
|
|
+// downloadTitle = NSLocalizedString(@"File_down_type_video",nil);
|
|
|
+// }
|
|
|
+//
|
|
|
+// UILabel *uploadLabel = [[UILabel alloc] init];
|
|
|
+// uploadLabel.textColor = [UIColor whiteColor];
|
|
|
+// uploadLabel.font = [UIFont boldSystemFontOfSize:18.0];
|
|
|
+// uploadLabel.numberOfLines = 0;
|
|
|
+// [uploadButton addSubview:uploadLabel];
|
|
|
+//
|
|
|
+// NSString *totalStr = [[NSString alloc] initWithFormat:@"%@\n%@",uploadTitle,uploadTip];
|
|
|
+//
|
|
|
+// NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
|
|
|
+//
|
|
|
+// NSRange redRange = NSMakeRange([totalStr rangeOfString:uploadTip].location, [totalStr rangeOfString:uploadTip].length);
|
|
|
+// [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#FFFFFF" alpha:0.8] range:redRange];
|
|
|
+// [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:redRange];
|
|
|
+// // 设置行间距
|
|
|
+// NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
|
|
+// [paragraphStyle setLineSpacing:5]; //设置行间距
|
|
|
+//
|
|
|
+// [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr length])];
|
|
|
+//
|
|
|
+// uploadLabel.attributedText = noteStr;
|
|
|
+//
|
|
|
+// [uploadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.mas_equalTo(15);
|
|
|
+// make.right.mas_equalTo(-15);
|
|
|
+// make.bottom.mas_equalTo(0);
|
|
|
+// make.top.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+//
|
|
|
+// UILabel *downloadLabel = [[UILabel alloc] init];
|
|
|
+// downloadLabel.textColor = [UIColor whiteColor];
|
|
|
+// downloadLabel.font = [UIFont boldSystemFontOfSize:18.0];
|
|
|
+// downloadLabel.numberOfLines = 0;
|
|
|
+// [downButton addSubview:downloadLabel];
|
|
|
+//
|
|
|
+// NSString *downTotalStr = [[NSString alloc] initWithFormat:@"%@\n%@",downloadTitle,downloadTip];
|
|
|
+//
|
|
|
+// NSMutableAttributedString *downNoteStr = [[NSMutableAttributedString alloc] initWithString:downTotalStr];
|
|
|
+//
|
|
|
+// NSRange downredRange = NSMakeRange([downTotalStr rangeOfString:downloadTip].location, [downTotalStr rangeOfString:downloadTip].length);
|
|
|
+// [downNoteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#FFFFFF" alpha:0.8] range:downredRange];
|
|
|
+// [downNoteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:downredRange];
|
|
|
+// // 设置行间距
|
|
|
+//// NSMutableParagraphStyle *paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
|
|
|
+//// [paragraphStyle1 setLineSpacing:5]; //设置行间距
|
|
|
+//
|
|
|
+// [downNoteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [downTotalStr length])];
|
|
|
+//
|
|
|
+// downloadLabel.attributedText = downNoteStr;
|
|
|
+//
|
|
|
+// [downloadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.mas_equalTo(15);
|
|
|
+// make.right.mas_equalTo(-15);
|
|
|
+// make.bottom.mas_equalTo(0);
|
|
|
+// make.top.mas_equalTo(0);
|
|
|
+// }];
|
|
|
+//}
|
|
|
+
|
|
|
+
|
|
|
+- (void)tapUpFun:(UITapGestureRecognizer*)tap
|
|
|
+{
|
|
|
+ //[self deleteFromSuperview];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)deleteFromSuperview
|
|
|
+{
|
|
|
+
|
|
|
+ [self removeFromSuperview];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)didClickButtonFun:(UIButton*)button
|
|
|
+{
|
|
|
+ [self deleteFromSuperview];
|
|
|
+
|
|
|
+ if(_didClickBut)
|
|
|
+ {
|
|
|
+ _didClickBut(1);
|
|
|
+ }
|
|
|
+}
|
|
|
+@end
|