uploadFileBottomView.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //
  2. // uploadFileBottomView.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/11/10.
  6. //
  7. #import "uploadFileBottomView.h"
  8. @interface uploadFileBottomView ()
  9. @property(nonatomic,strong)UILabel *selectNumLabel;
  10. @property(nonatomic,strong)UILabel *uploadFileRoutelabel;
  11. @property(nonatomic,strong)UIButton *uploadButon;
  12. @end
  13. @implementation uploadFileBottomView
  14. - (id)initWithFrame:(CGRect)frame{
  15. self = [super initWithFrame:frame];
  16. [self drawAnyView];
  17. return self;
  18. }
  19. - (void)drawAnyView{
  20. [self setBackgroundColor:[UIColor whiteColor]];
  21. _selectNumLabel = [[UILabel alloc] init];
  22. _selectNumLabel.font = [UIFont boldSystemFontOfSize:16.0];
  23. [self addSubview:_selectNumLabel];
  24. [_selectNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.left.mas_equalTo(15);
  26. make.top.mas_equalTo(10);
  27. make.right.mas_equalTo(-110);
  28. make.height.mas_equalTo(20);
  29. }];
  30. NSString *curStr1 = [NSString stringWithFormat:@"%@",@"已选0项"];
  31. NSString *curStr2 = [NSString stringWithFormat:@"%@",@"(0kb,可用120.00GB)"];
  32. NSString *totalStr = [[NSString alloc] initWithFormat:@"%@ %@",curStr1,curStr2];
  33. NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:totalStr];
  34. NSRange redRange = NSMakeRange([totalStr rangeOfString:curStr2].location, [totalStr rangeOfString:curStr2].length);
  35. [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor hwColor:@"#959799" alpha:1.0] range:redRange];
  36. [noteStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14.0] range:redRange];
  37. // 设置行间距
  38. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  39. [paragraphStyle setLineSpacing:5]; //设置行间距
  40. [noteStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [totalStr length])];
  41. _selectNumLabel.attributedText = noteStr;
  42. _uploadFileRoutelabel = [[UILabel alloc] init];
  43. _uploadFileRoutelabel.font = [UIFont systemFontOfSize:14.0];
  44. _uploadFileRoutelabel.textColor = [UIColor hwColor:@"#959799" alpha:1.0];
  45. _uploadFileRoutelabel.text = @"上传路径:xxxxxxxxxxxxxxx";
  46. [self addSubview:_uploadFileRoutelabel];
  47. [_uploadFileRoutelabel mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.left.mas_equalTo(15);
  49. make.top.mas_equalTo(_selectNumLabel.mas_bottom).offset(10);
  50. make.right.mas_equalTo(-110);
  51. make.height.mas_equalTo(20);
  52. }];
  53. //图片上传
  54. NSString* curImgUploadStr = [[NSString alloc] initWithFormat:@"%@ %@",@" ",NSLocalizedString(@"my_set_no_File_upload",nil)];
  55. // gradient
  56. CAGradientLayer *gl_But = [CAGradientLayer layer];
  57. gl_But.frame = CGRectMake(0,0,88.f,40.f);
  58. gl_But.startPoint = CGPointMake(0, 0.5);
  59. gl_But.endPoint = CGPointMake(1, 0.5);
  60. gl_But.colors = @[(__bridge id)HW0CDEFDColor.CGColor, (__bridge id)HW058DFBColor.CGColor];
  61. gl_But.locations = @[@(0), @(1.0f)];
  62. gl_But.cornerRadius = 8;
  63. UIButton *imageUploadBut = [[UIButton alloc] init];
  64. [imageUploadBut setImage:[UIImage imageNamed:@"upload_file_white_100"] forState:UIControlStateNormal];
  65. [imageUploadBut setTitle:curImgUploadStr forState:UIControlStateNormal];
  66. [imageUploadBut setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  67. imageUploadBut.titleLabel.font = [UIFont boldSystemFontOfSize:13.0];
  68. imageUploadBut.tag = 2;
  69. [imageUploadBut addTarget:self action:@selector(didClickButFun:) forControlEvents:UIControlEventTouchUpInside];
  70. [self addSubview:imageUploadBut];
  71. [imageUploadBut.layer insertSublayer:gl_But atIndex:0];
  72. [imageUploadBut bringSubviewToFront:imageUploadBut.imageView];
  73. self.uploadButon = imageUploadBut;
  74. //imageUploadBut.backgroundColor = [UIColor redColor];
  75. [imageUploadBut mas_makeConstraints:^(MASConstraintMaker *make) {
  76. make.right.mas_equalTo(-15);
  77. make.top.mas_equalTo(10);
  78. make.width.mas_equalTo(88);
  79. make.height.mas_equalTo(40);
  80. }];
  81. imageUploadBut.enabled = NO;
  82. //imageUploadBut.alpha = 0.5;
  83. }
  84. #pragma mark 按钮点击
  85. - (void)didClickButFun:(UIButton*)but
  86. {
  87. }
  88. @end