123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- //
- // filePathCreatTableViewCell.m
- // 隐私保护
- //
- // Created by xd h on 2023/12/29.
- //
- #import "filePathCreatTableViewCell.h"
- @implementation filePathCreatTableViewCell
- @synthesize cellBgView;
- @synthesize mImageView;
- @synthesize titleLabel;
- @synthesize titleLabel2;
- @synthesize rightImage;
- @synthesize lineView;
- @synthesize checkButton;
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
-
- if (self)
- {
- [self drawView];
- }
-
- return self;
- }
- - (void)drawView
- {
- cellBgView = [[UIView alloc] init];
- [self.contentView addSubview:cellBgView];
- //cellBgView.backgroundColor = [UIColor whiteColor];
- [cellBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(0.f);
- make.top.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.right.mas_equalTo(0.f);
- //make.width.mas_equalTo(SCREEN_W - 2*15.f);
- }];
-
- /*图片*/
- mImageView = [[UIImageView alloc] init];
- [mImageView setBackgroundColor:[UIColor clearColor]];
- mImageView.image = [UIImage imageNamed:@"uploadFile_disk_icon"];
- [cellBgView addSubview:mImageView];
- [mImageView setContentMode:(UIViewContentModeScaleAspectFill)];
- [mImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.width.mas_equalTo(36);
- make.height.mas_equalTo(36);
- make.centerY.equalTo(cellBgView.mas_centerY);
- }];
-
- /*右侧箭头*/
- rightImage = [[UIImageView alloc] init];
- [rightImage setBackgroundColor:[UIColor clearColor]];
- [rightImage setImage:[UIImage imageNamed:@"cell_right_access"]];
- [cellBgView addSubview:rightImage];
- [rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
- make.width.mas_equalTo(28);
- make.right.mas_equalTo(-15.f);
- make.height.mas_equalTo(28);
- make.centerY.equalTo(cellBgView.mas_centerY);
- }];
-
- checkButton = [[UIButton alloc] init];
- [checkButton setImage:[UIImage imageNamed:@"upload_file_uncheck"] forState:UIControlStateNormal];
- [checkButton setImage:[UIImage imageNamed:@"upload_file_check"] forState:UIControlStateSelected];
- [cellBgView addSubview:checkButton];
- [checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-18.f);
- make.centerY.equalTo(cellBgView.mas_centerY);
- make.width.mas_equalTo(36.f);
- make.height.mas_equalTo(36.f);
- }];
-
- [checkButton addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventTouchUpInside)];
-
-
- /**标题*/
- titleLabel = [[UILabel alloc] init];
- [cellBgView addSubview:titleLabel];
- titleLabel.font = [UIFont boldSystemFontOfSize:14.f];
- titleLabel.numberOfLines = 0;
- [titleLabel setTextColor:HW0A132BColor];
- [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(mImageView.mas_right).offset(5.f);
- make.right.equalTo(checkButton.mas_left).offset(-5.f);
- //make.centerY.equalTo(cellBgView.mas_centerY);
- make.top.mas_equalTo(15.f);
- }];
-
- /**副标题*/
- titleLabel2 = [[UILabel alloc] init];
- [cellBgView addSubview:titleLabel2];
- titleLabel2.font = [UIFont systemFontOfSize:12.f];
- //[titleLabel2 setTextAlignment:(NSTextAlignmentRight)];
- [titleLabel2 setTextColor:HW666666Color];
- [titleLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-53.f);
- make.left.mas_equalTo(titleLabel.mas_left);
- //make.centerY.equalTo(cellBgView.mas_centerY);
- make.bottom.mas_equalTo(-15);
- }];
-
- lineView = [[UIView alloc] init];
- [lineView setBackgroundColor:HW979797Color10];
- [cellBgView addSubview:lineView];
- [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-15.f);
- make.left.mas_equalTo(15.f);
- make.bottom.mas_equalTo(0);
- make.height.mas_equalTo(1.f);
- }];
-
-
- //titleLabel2.text = @"30GB/128GB";
- }
- - (void)setCurModel:(cloudPhoneExtraFileModel *)curModel
- {
- titleLabel.text = curModel.name;
-
- CGFloat extraAvableSizeF = curModel.extraAvableSize / 1024.0 /1024.0/1024.0;
- CGFloat extraTotalSizeF = curModel.extraTotalSize / 1024.0 /1024.0/1024.0;
-
- titleLabel2.text = [[NSString alloc] initWithFormat:@"%.2fGB/%.2fGB",extraAvableSizeF,extraTotalSizeF];
-
- checkButton.selected = curModel.isCheckType;
- }
- - (void)maskSwitchPressed:(UIButton *)maskSwitch{
- maskSwitch.selected = !maskSwitch.selected;
-
- if(_didClickSwitch){
- _didClickSwitch(maskSwitch.selected);
- }
- }
- @end
|