fileTransferPathCheckViewController.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. //
  2. // fileTransferPathCheckViewController.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/12/28.
  6. //
  7. #import "fileTransferPathCheckViewController.h"
  8. #import "fileTransferPathCheckTableViewCell.h"
  9. #import "filePathCreatPopView.h"
  10. #import "IQKeyboardManager.h"
  11. @interface fileTransferPathCheckViewController ()<UITableViewDelegate,UITableViewDataSource>
  12. @property (nonatomic, strong) UITableView *tableView;
  13. @end
  14. @implementation fileTransferPathCheckViewController
  15. - (void)viewDidLoad {
  16. [super viewDidLoad];
  17. // Do any additional setup after loading the view.
  18. [self.toolBar setHidden:YES];
  19. [self.navigationBar setHidden:YES];
  20. [self.navBarBGView setHidden:NO];
  21. [self.titleLabel setText:NSLocalizedString(@"File_upload_path_check",nil)];
  22. [self.view setBackgroundColor:HWF5F7FAColor];
  23. [self drawAnyView];
  24. [self setupKeyboardManager];
  25. }
  26. - (void)drawAnyView{
  27. UIButton* rightButton = [[UIButton alloc] init];
  28. [rightButton setTitle:NSLocalizedString(@"File_upload_path_new",nil) forState:UIControlStateNormal];
  29. [rightButton setTitleColor:[UIColor hwColor:@"#01B7EA" alpha:1.0] forState:UIControlStateNormal];
  30. rightButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
  31. rightButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
  32. [rightButton addTarget:self action:@selector(didiClikRightButFun:) forControlEvents:UIControlEventTouchUpInside];
  33. [self.navBarBGView addSubview:rightButton];
  34. [rightButton mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.width.mas_equalTo(120);
  36. make.height.mas_equalTo(40);
  37. make.right.mas_equalTo(-15);
  38. make.centerY.mas_equalTo(self.titleLabel.mas_centerY);
  39. }];
  40. [self.view addSubview:self.tableView];
  41. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.left.mas_equalTo(0);
  43. make.right.mas_equalTo(0);
  44. make.bottom.mas_equalTo(0);
  45. make.top.equalTo(self.navBarBGView.mas_bottom).offset(10.f);
  46. }];
  47. }
  48. - (void)viewWillAppear:(BOOL)animated
  49. {
  50. [super viewWillAppear:animated];
  51. IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
  52. keyboardManager.enable = YES;
  53. }
  54. - (void)viewWillDisappear:(BOOL)animated
  55. {
  56. [super viewWillDisappear:animated];
  57. IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
  58. keyboardManager.enable = NO;
  59. }
  60. - (void)setupKeyboardManager {
  61. IQKeyboardManager *keyboardManager = [IQKeyboardManager sharedManager];
  62. keyboardManager.enable = YES;
  63. keyboardManager.shouldResignOnTouchOutside = YES;
  64. keyboardManager.shouldShowToolbarPlaceholder = NO;
  65. keyboardManager.enableAutoToolbar = NO;
  66. }
  67. #pragma mark - 懒加载
  68. - (UITableView *)tableView{
  69. if (!_tableView) {
  70. _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H - TABBARHEIGHT) style:UITableViewStylePlain];
  71. _tableView.delegate = self;
  72. _tableView.dataSource = self;
  73. _tableView.showsVerticalScrollIndicator = NO;
  74. _tableView.showsHorizontalScrollIndicator = NO;
  75. // _tableView.contentInset = UIEdgeInsetsMake(-H_STATE_BAR, 0, 0, 0);
  76. [_tableView setSeparatorStyle:(UITableViewCellSeparatorStyleNone)];
  77. [_tableView setSeparatorColor:[UIColor clearColor]];
  78. [_tableView setBackgroundColor:[UIColor clearColor]];
  79. [_tableView setTableFooterView:[UIView new]];
  80. [_tableView setBounces:YES];
  81. if (@available(iOS 15.0, *)) {
  82. _tableView.sectionHeaderTopPadding = 0;
  83. }
  84. }
  85. return _tableView;
  86. }
  87. #pragma mark - 列表委托
  88. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  89. return 1;
  90. }
  91. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  92. return 2;
  93. }
  94. - (fileTransferPathCheckTableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  95. __block NSInteger row = indexPath.row;
  96. static NSString *identifier = @"fileTransferPathCheckTableViewCell";
  97. fileTransferPathCheckTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier];
  98. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  99. if (!cell){
  100. cell = [[fileTransferPathCheckTableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
  101. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  102. [cell setBackgroundColor:[UIColor clearColor]];
  103. [cell setAccessoryType:(UITableViewCellAccessoryNone)];
  104. [cell.bgViewLayer removeFromSuperlayer];
  105. [cell.titleLabel2 setHidden:NO];
  106. [cell.rightImage setHidden:YES];
  107. [cell.lineView setHidden:NO];
  108. [cell.checkButton setHidden:NO];
  109. }
  110. if (row == 0){
  111. //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_Cellular",nil)];
  112. cell.titleLabel.text = @"云机名称/我的空间/来自[手机名称]的[XX]文件备份";
  113. cell.checkButton.selected = YES;
  114. /*上圆角*/
  115. //设置部分圆角 贝塞尔曲线
  116. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 90)
  117. byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
  118. cornerRadii:CGSizeMake(8, 8)];
  119. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  120. maskLayer.frame = cell.cellBgView.bounds;
  121. maskLayer.path = maskPath.CGPath;
  122. cell.bgViewLayer = maskLayer;
  123. cell.cellBgView.layer.mask = cell.bgViewLayer;
  124. }else if (row == 1){
  125. //[cell.titleLabel setText:NSLocalizedString(@"File_Transfer_set_battery_level",nil)];
  126. cell.titleLabel.text = @"云机名称/我的空间/XYJ";
  127. /*下圆角*/
  128. UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, SCREEN_W-30 , 90)
  129. byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight
  130. cornerRadii:CGSizeMake(8, 8)];
  131. CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
  132. maskLayer.frame = cell.cellBgView.bounds;
  133. maskLayer.path = maskPath.CGPath;
  134. cell.bgViewLayer = maskLayer;
  135. cell.cellBgView.layer.mask = cell.bgViewLayer;
  136. [cell.lineView setHidden:YES];
  137. }
  138. KWeakSelf
  139. cell.didClickSwitch = ^(BOOL SwitchOn) {
  140. };
  141. return cell;
  142. }
  143. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  144. return 90;
  145. }
  146. - (void)didiClikRightButFun:(UIButton*)but
  147. {
  148. filePathCreatPopView * filePathCreatPopV = [[filePathCreatPopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_W, SCREEN_H)];
  149. //[self.view.window addSubview:filePathCreatPopV];
  150. [self.view addSubview:filePathCreatPopV];
  151. // KWeakSelf
  152. // filePathCreatPopV.didClickBut = ^(NSInteger tag) {
  153. //
  154. // };
  155. }
  156. @end