// // ASCheckoutAddressCell.m // Asteria // // Created by xingyu on 2024/5/9. // #import "ASCheckoutAddressCell.h" @implementation ASCheckoutAddressData @end @interface ASCheckoutAddressCell() @property (nonatomic, strong) UIView *backView; @property (nonatomic, strong) UIImageView *arrowRightImgV; @property (nonatomic, strong) UILabel *shipTitleLab; @property (nonatomic, strong) UILabel *addressLab; @end @implementation ASCheckoutAddressCell - (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 } - (void)setupSubviewS { self.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"]; [self.contentView addSubview:self.backView]; [self.backView addSubview:self.arrowRightImgV]; [self.backView addSubview:self.shipTitleLab]; [self.backView addSubview:self.addressLab]; [self.backView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.mas_equalTo(10); make.right.mas_equalTo(-10); make.bottom.mas_equalTo(0); }]; [self.arrowRightImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.centerY.equalTo(self.backView); make.width.height.mas_equalTo(14); }]; [self.shipTitleLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.top.mas_equalTo(20); }]; [self.addressLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-48); make.top.equalTo(self.shipTitleLab.mas_bottom).offset(10); make.height.mas_equalTo(18); make.bottom.mas_equalTo(-20); }]; } - (void)configData:(id)Data{ ASCheckoutAddressData *model = (ASCheckoutAddressData *)Data; ASAddressModel *addressModel = model.addressModel; if (addressModel) { NSString *addressInfoStr = [NSString stringWithFormat:@"%@ %@ %@ %@,%@ tel:%@", addressModel.firstname, addressModel.lastname, [addressModel.street componentsJoinedByString:@" "], addressModel.city, addressModel.postcode, addressModel.telephone]; self.addressLab.textColor = _0B0B0B; self.addressLab.text = addressInfoStr; } else { self.addressLab.textColor = [UIColor getColor:@"#E60013"]; self.addressLab.text = @"Please fill in your address"; } } - (UIView *)backView { if (!_backView) { _backView = [[UIView alloc] init]; TT_ViewRadius(_backView, 4); _backView.backgroundColor = [UIColor whiteColor]; } return _backView; } - (UIImageView *)arrowRightImgV { if (!_arrowRightImgV) { _arrowRightImgV = [[UIImageView alloc] init]; _arrowRightImgV.image = [UIImage imageNamed:@"productList_more_right"]; } return _arrowRightImgV; } - (UILabel *)shipTitleLab { if (!_shipTitleLab) { _shipTitleLab = [UILabel labelCreateWithText:@"ship to" font:[UIFont fontWithName:Rob_Regular size:12] textColor:Col_666]; } return _shipTitleLab; } - (UILabel *)addressLab { if (!_addressLab) { _addressLab = [UILabel labelCreateWithText:@"" font:[UIFont fontWithName:Rob_Bold size:14] textColor:_0B0B0B]; } return _addressLab; } @end