123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- //
- // NASLastFileView.m
- // 双子星云手机
- //
- // Created by xd h on 2024/6/19.
- //
- #import "NASLastFileView.h"
- @interface NASLastFileView ()
- @property(nonatomic,strong) UILabel*titleLabel;
- @property(nonatomic,strong)UIButton *eyeButton;
- @end
- @implementation NASLastFileView
- - (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 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);
- }];
-
-
- //空白页
- UIImageView* 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);
- }];
-
- UILabel *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(_didClickButtonFun){
- _didClickButtonFun(tag);
- }
- }
- @end
|