// // ASPointEranCell.m // Asteria // // Created by iOS on 2023/6/24. // #import "ASPointEranCell.h" @interface ASPointEranCell () @property (nonatomic, strong) UILabel *titleLb; @property (nonatomic, strong) UILabel *desLb; @property (nonatomic, strong) UIImageView *moreIconV; @property (nonatomic, strong) UIView *lineV; @end @implementation ASPointEranCell - (void)setData:(NSString *)title des:(NSString *)des status:(BOOL)status { self.titleLb.text = title; self.desLb.text = des; if (status) { self.titleLb.textColor = Col_666; self.titleLb.font = [UIFont fontWithName:Rob_Regular size:14]; self.desLb.textColor = Col_000; self.moreIconV.hidden = true; } else { self.titleLb.textColor = Col_000; self.titleLb.font = [UIFont fontWithName:Rob_Bold size:14]; self.desLb.textColor = Col_000; self.moreIconV.hidden = false; } } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { [self loadSubVs]; } return self; } - (void)loadSubVs { self.backgroundColor = Col_FFF; self.contentView.backgroundColor = Col_FFF; self.selectionStyle = UITableViewCellSelectionStyleNone; [self.contentView addSubview:self.lineV]; [self.contentView addSubview:self.titleLb]; [self.contentView addSubview:self.desLb]; [self.contentView addSubview:self.moreIconV]; [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) { make.top.leading.equalTo(self.contentView).offset(20); make.bottom.equalTo(self.contentView).offset(-20); make.height.greaterThanOrEqualTo(@17); }]; [self.moreIconV mas_makeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@7); make.height.equalTo(@17); make.top.equalTo(self.contentView).offset(20); make.trailing.equalTo(self.contentView).offset(-20); make.leading.equalTo(self.desLb.mas_trailing).offset(10); }]; [self.desLb mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.contentView).offset(20); make.leading.equalTo(self.titleLb.mas_trailing).offset(10); make.width.equalTo(@112); make.height.equalTo(@17); }]; [self.lineV mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.equalTo(self.contentView).offset(20); make.trailing.equalTo(self.contentView).offset(-20); make.bottom.equalTo(self.contentView); make.height.equalTo(@1); }]; [self.desLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; [self.titleLb setContentHuggingPriority:UILayoutPriorityFittingSizeLevel forAxis:UILayoutConstraintAxisHorizontal]; [self.titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; } - (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 } - (UILabel *)titleLb { if (!_titleLb) { UILabel *lb = [[UILabel alloc] init]; lb.textColor = Col_000; lb.font = [UIFont fontWithName:Rob_Bold size:14]; lb.textAlignment = NSTextAlignmentLeft; lb.numberOfLines = 0; _titleLb = lb; } return _titleLb; } - (UILabel *)desLb { if (!_desLb) { UILabel *lb = [[UILabel alloc] init]; lb.textColor = Col_000; lb.font = [UIFont fontWithName:Rob_Regular size:14]; lb.textAlignment = NSTextAlignmentRight; _desLb = lb; } return _desLb; } - (UIImageView *)moreIconV { if (!_moreIconV) { UIImageView *v = [UIImageView new]; v.contentMode = UIViewContentModeScaleAspectFit; v.image = [UIImage imageNamed:@"uc_more"]; _moreIconV = v; } return _moreIconV; } - (UIView *)lineV { if (!_lineV) { UIView *v = [UIView new]; v.backgroundColor = _043632; v.alpha = 0.1; _lineV = v; } return _lineV; } @end