123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- //
- // fileSetTableViewCell.m
- // 隐私保护
- //
- // Created by xd h on 2023/12/28.
- //
- #import "fileSetTableViewCell.h"
- @implementation fileSetTableViewCell
- @synthesize cellBgView;
- @synthesize mImageView;
- @synthesize titleLabel;
- @synthesize titleLabel2;
- @synthesize rightImage;
- @synthesize lineView;
- @synthesize maskSwitch;
- - (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(15.f);
- make.top.mas_equalTo(0);
- make.bottom.mas_equalTo(0);
- make.width.mas_equalTo(SCREEN_W - 2*15.f);
- }];
-
- /*图片*/
- mImageView = [[UIImageView alloc] init];
- [mImageView setBackgroundColor:[UIColor clearColor]];
- [cellBgView addSubview:mImageView];
- [mImageView setContentMode:(UIViewContentModeScaleAspectFill)];
- [mImageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.mas_equalTo(15);
- make.width.mas_equalTo(28);
- make.height.mas_equalTo(28);
- 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);
- }];
-
- maskSwitch = [[UISwitch alloc] init];
- [cellBgView addSubview:maskSwitch];
- [maskSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.mas_equalTo(-18.f);
- make.centerY.equalTo(cellBgView.mas_centerY);
- }];
- [maskSwitch setOnTintColor:HW13B2EBColor];
- [maskSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:(UIControlEventValueChanged)];
- BOOL haveOpenMask = [HWDataManager getBoolWithKey:Consn_Fanzhuan_Exit_app_Open];
- [maskSwitch setOn:haveOpenMask];
- /**标题*/
- titleLabel = [[UILabel alloc] init];
- [cellBgView addSubview:titleLabel];
- titleLabel.font = [UIFont boldSystemFontOfSize:14.f];
- //titleLabel.adjustsFontSizeToFitWidth = YES;
- titleLabel.numberOfLines = 2;
- [titleLabel setTextColor:HW0A132BColor];
- [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- //make.left.equalTo(mImageView.mas_right).offset(5.f);
- make.left.mas_equalTo(10.f);
- make.right.mas_equalTo(-60.f);
- make.centerY.equalTo(cellBgView.mas_centerY);
- make.height.mas_equalTo(35.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(100.f);
- make.centerY.equalTo(cellBgView.mas_centerY);
- }];
-
- 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);
- }];
- }
- - (void)maskSwitchPressed:(UISwitch *)maskSwitch{
- if(_didClickSwitch){
- _didClickSwitch(maskSwitch.on);
- }
- }
- @end
|