// // ApplicationManageTableViewCell.m // tongxin // // Created by ecell on 2023/7/12. // Copyright © 2023 xTT. All rights reserved. // #import "ApplicationManageTableViewCell.h" @interface ApplicationManageTableViewCell () @property (nonatomic ,weak) UILabel *titleLabel; @property (nonatomic ,weak) UILabel *timeLabel; @property (nonatomic ,weak) UILabel *timeframeLabel; @property (nonatomic ,weak) UISwitch *customSwitch; @end @implementation ApplicationManageTableViewCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.backgroundColor = KKClearColor; [self subCellView]; } return self; } - (void)setListModel:(ApplicationManageModel *)listModel { _listModel = listModel; self.titleLabel.text = listModel.name; [self.customSwitch setOn:listModel.status.boolValue]; } - (void)subCellView { UILabel *titleLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(20) textColor:KKTextColor text:@"水电费" Radius:0]; self.titleLabel = titleLabel; [self.contentView addSubview:titleLabel]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(20); make.top.equalTo(self.contentView).inset(10); }]; /// 时间 UILabel *timeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(13) textColor:RGB(163, 163, 163) text:@"-" Radius:0]; self.timeLabel = timeLabel; [self.contentView addSubview:timeLabel]; [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.contentView).inset(20); make.bottom.equalTo(self.contentView.mas_bottom).inset(10); }]; UISwitch *customSwitch = [[UISwitch alloc] init]; [customSwitch setOnTintColor:mainColor]; // [customSwitch addTarget:self action:@selector(switchBtnClick:) forControlEvents:UIControlEventValueChanged]; self.customSwitch = customSwitch; [self.contentView addSubview:customSwitch]; [customSwitch mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.contentView.mas_right).inset(20); make.centerY.equalTo(self.contentView); //make.size.mas_equalTo(CGSizeMake(Adapted(80), Adapted(40))); }]; UILabel *timeframeLabel = [UICommon ui_label:CGRectZero lines:0 align:NSTextAlignmentLeft font:Font_(20) textColor:KKTextColor text:@"0" Radius:0]; self.timeframeLabel = timeframeLabel; [self.contentView addSubview:timeframeLabel]; [timeframeLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(customSwitch.mas_left).inset(45); make.centerY.equalTo(self.contentView.mas_centerY).inset(10); }]; } - (void)awakeFromNib { [super awakeFromNib]; // Initialization code } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end