// // NASMySpaceView.m // Private-X // // Created by xd h on 2024/6/19. // #import "NASMySpaceView.h" @interface NASMySpaceView () @property(nonatomic,strong) UILabel*titleLabel; //渐变色进度条 @property(nonatomic,strong) UIView *progressBgView; @property(nonatomic,strong) UIView *progressSelectView; @property(nonatomic,strong) CAGradientLayer *glayer; @end @implementation NASMySpaceView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; //self.backgroundColor = [UIColor clearColor]; [self drawAnyView]; return self; } -(void)drawAnyView { 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.top.mas_equalTo(0); make.left.mas_equalTo(16); make.right.mas_equalTo(-16); make.bottom.mas_equalTo(0); }]; _titleLabel = [[UILabel alloc] init]; _titleLabel.font = [UIFont systemFontOfSize:12.0]; _titleLabel.textColor = [UIColor hwColor:@"#818CA2"]; [whiteBgView addSubview:_titleLabel]; [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(16); make.left.mas_equalTo(16); make.right.mas_equalTo(-24-12-10); make.height.mas_equalTo(20); }]; [self setTitleLabelTextFunBy:@"--GB/--GB"]; //添加按钮 后面做个大按钮响应 UIButton *rightButton = [[UIButton alloc] init]; [rightButton setBackgroundImage:[UIImage imageNamed:@"common_right_arrow"] forState:UIControlStateNormal]; // rightButton.tag = 1; // [rightButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside]; [whiteBgView addSubview:rightButton]; [rightButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(16); make.right.mas_equalTo(-12); make.width.mas_equalTo(24); make.height.mas_equalTo(24); }]; _progressBgView = [[UIView alloc] init]; _progressBgView.backgroundColor = [UIColor hwColor:@"#E7EFFA" alpha:1.0]; _progressBgView.layer.cornerRadius = 5; _progressBgView.layer.masksToBounds = YES; [whiteBgView addSubview:_progressBgView]; [_progressBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(16); make.right.mas_equalTo(-16); make.height.mas_equalTo(10); make.top.equalTo(_titleLabel.mas_bottom).offset(12); }]; _progressSelectView = [[UIView alloc] init]; _progressSelectView.layer.cornerRadius = 5; _progressSelectView.layer.masksToBounds = YES; [_progressBgView addSubview:_progressSelectView]; // gradient _glayer = [CAGradientLayer layer]; _glayer.startPoint = CGPointMake(0, 0.5); _glayer.endPoint = CGPointMake(0.97, 0.5); _glayer.colors = @[(__bridge id)[UIColor hwColor:@"#0CDEFD" alpha:1.0].CGColor, (__bridge id)[UIColor hwColor:@"#058DFB" alpha:1.0].CGColor]; _glayer.locations = @[@(0), @(1.0f)]; [_progressSelectView.layer addSublayer:_glayer]; // dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // [self setProgressFun]; // }); //大按钮响应 UIButton *bigRightButton = [[UIButton alloc] init]; bigRightButton.tag = 1; [bigRightButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside]; [whiteBgView addSubview:bigRightButton]; //bigRightButton.backgroundColor= [UIColor redColor]; [bigRightButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(16); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.equalTo(_progressSelectView.mas_bottom).offset(0); }]; NSArray *titleArr = @[NSLocalizedString(@"my_set_no_image_upload",nil), NSLocalizedString(@"my_set_no_video_upload",nil), NSLocalizedString(@"my_set_no_music",nil), NSLocalizedString(@"my_set_no_file",nil)]; NSArray *imageArr = @[@"nas_picture_icon", @"nas_video_icon", @"nas_audio_icon", @"nas_file_icon"]; CGFloat butTopY = 74.0; CGFloat butWidth = 52.0; CGFloat butHeight = 52.0 +20 +5; CGFloat leftSpace = 20.0; CGFloat butSpace = (SCREEN_W -16*2 -leftSpace*2 - butWidth*titleArr.count)/3.0; for (int i=0; i