// // previewAudioPortraitDetailsView.m // 双子星云手机 // // Created by xd h on 2024/7/15. // #import "previewAudioPortraitDetailsView.h" @interface previewAudioPortraitDetailsView () @property (nonatomic, strong)NASFileAudioDataModel *dataModel; @end @implementation previewAudioPortraitDetailsView - (id)initWithFrame:(CGRect)frame withData:(NASFileAudioDataModel*)dataModel{ self = [super initWithFrame:frame]; self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.6]; _dataModel = dataModel; [self drawAnyView]; return self; } -(void)drawAnyView { //大按钮响应 UIButton *bigRightButton = [[UIButton alloc] init]; bigRightButton.tag = 1; [bigRightButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:bigRightButton]; //bigRightButton.backgroundColor= [UIColor greenColor]; [bigRightButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(0); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; UIView *whiteBgView = [[UIView alloc] init]; whiteBgView.backgroundColor = [UIColor whiteColor]; [self addSubview:whiteBgView]; whiteBgView.layer.cornerRadius = 12; whiteBgView.layer.masksToBounds = YES; [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.mas_equalTo(20); make.right.mas_equalTo(0); make.left.mas_equalTo(0); make.height.mas_equalTo(254 + 20); //make.height.mas_equalTo(150); }]; NSArray *butTextArr = @[NSLocalizedString(@"NAS_details_file_type",nil), NSLocalizedString(@"NAS_details_file_name",nil), NSLocalizedString(@"NAS_details_file_date",nil), NSLocalizedString(@"NAS_details_file_size",nil), NSLocalizedString(@"NAS_details_file_path",nil)]; CGFloat labelHeight = 40.0; for (int i=0; i= 1024 && totalSize_k < 1024*1024){ totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fMB",totalSize_k/1024.0]; } else{ totalSizeStr = [[NSString alloc] initWithFormat:@"%.2fG",totalSize_k/1024.0/1024.0]; } rightLab.text = totalSizeStr; } break; case 4:{ NSString *path = _dataModel.path; path = [iTools changePathToShowPathBy:path]; rightLab.text = path; } break; default: break; } } } #pragma mark 按钮事件 - (void)didClickButtonFun:(UIButton*)but { NSInteger tag = but.tag; HLog(@"%ld",tag); [self removeFun]; } - (void)removeFun { [self removeFromSuperview]; } @end