// // NASLastFileView.m // 双子星云手机 // // Created by xd h on 2024/6/19. // #import "NASLastFileView.h" @interface NASLastFileView () @property(nonatomic,strong) UILabel*titleLabel; @end @implementation NASLastFileView - (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; //self.backgroundColor = [UIColor clearColor]; [self drawAnyView]; return self; } -(void)drawAnyView { _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 boldSystemFontOfSize:16.0]; _titleLabel.textColor = [UIColor hwColor:@"#0A132B"]; _titleLabel.text = NSLocalizedString(@"NAS_last_file",nil); [_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); }]; //按钮 UIButton *rightButton = [[UIButton alloc] init]; [rightButton setBackgroundImage:[UIImage imageNamed:@"common_right_back_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); }]; UIView *lineView = [[UIView alloc] init]; lineView.backgroundColor = [UIColor hwColor:@"#CFD1D4"]; [_whiteBgView addSubview:lineView]; [lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(rightButton.mas_top).offset(5); make.width.mas_equalTo(1); make.right.equalTo(rightButton.mas_left).offset(-13); make.bottom.equalTo(rightButton.mas_bottom).offset(-5); }]; //按钮 _eyeButton = [[UIButton alloc] init]; [_eyeButton setBackgroundImage:[UIImage imageNamed:@"common_eye_open_black"] forState:UIControlStateNormal]; [_eyeButton setBackgroundImage:[UIImage imageNamed:@"common_eye_close_black"] forState:UIControlStateSelected]; _eyeButton.tag = 2; [_eyeButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside]; [_whiteBgView addSubview:_eyeButton]; [_eyeButton mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(16); make.right.equalTo(lineView.mas_left).offset(-14); make.width.mas_equalTo(24); make.height.mas_equalTo(24); }]; //空白页 _notDataImageV = [[UIImageView alloc] init]; _notDataImageV.image = [UIImage imageNamed:@"nas_not_data"]; [_whiteBgView addSubview:_notDataImageV]; [_notDataImageV mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(_titleLabel.mas_bottom).offset(20); make.centerX.mas_equalTo(0); make.width.mas_equalTo(160); make.height.mas_equalTo(160); }]; _notDataLabel = [[UILabel alloc] init]; _notDataLabel.font = [UIFont systemFontOfSize:14.0]; _notDataLabel.textColor = [UIColor hwColor:@"#999999"]; _notDataLabel.text = NSLocalizedString(@"NAS_last_file_not_data_tip",nil); _notDataLabel.textAlignment = NSTextAlignmentCenter; [_whiteBgView addSubview:_notDataLabel]; [_notDataLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(_notDataImageV.mas_bottom).offset(-10); make.left.mas_equalTo(16); make.right.mas_equalTo(-16); make.height.mas_equalTo(20); }]; } #pragma mark 按钮事件 - (void)didClickButtonFun:(UIButton*)but { NSInteger tag = but.tag; HLog(@"%ld",tag); if(tag == 2){ [HWDataManager setBoolWithKey:Const_last_file_show value:but.selected]; //HLog(@"Const_last_file_show xxx:%d",but.selected) but.selected = !but.selected; //HLog(@"Const_last_file_show ddd:%d",but.selected) } if(_didClickButtonFun){ _didClickButtonFun(tag); } } @end