| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 | ////  ASMineAddressCell.m//  Asteria////  Created by iOS on 2024/5/7.//#import "ASMineAddressCell.h"@interface ASMineAddressCell ()@property (nonatomic, strong) UIView *bgV;@property (nonatomic, strong) UILabel *nameLB;@property (nonatomic, strong) UILabel *addressLB;@property (nonatomic, strong) UILabel *codeLB;@property (nonatomic, strong) UILabel *countryLB;@property (nonatomic, strong) UILabel *phoneLB;@end@implementation ASMineAddressCell- (void)setData:(ASAddressModel *)m {    if (m.title && ![m.title isEmpty]) {        self.titleLB.text = m.title;    } else {        self.titleLB.text = @"Other Address";    }    self.nameLB.text = [NSString stringWithFormat:@"%@ %@",m.lastname,m.firstname];    NSString *street = [m.street componentsJoinedByString:@" "];    self.addressLB.text = [NSString stringWithFormat:@"%@,%@,%@",m.city,m.region.region,street];    self.codeLB.text = m.postcode;//[NSString stringWithFormat:@""]    self.countryLB.text = m.country;    self.phoneLB.text = [NSString stringWithFormat:@"T:%@",m.telephone];}- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];    if (self) {        [self configSubV];    }    return self;}- (void)configSubV {    self.backgroundColor = [UIColor whiteColor];    self.selectionStyle = UITableViewCellSelectionStyleNone;    self.bgV = [UIView new];    self.bgV.backgroundColor = _F8F8F8;//    self.bgV.layer.cornerRadius = 4;//    self.bgV.layer.masksToBounds = true;    [self.contentView addSubview:self.bgV];    [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) {        make.top.equalTo(self.contentView).offset(0);        make.left.equalTo(self.contentView).offset(0);        make.centerX.equalTo(self.contentView);        make.bottom.equalTo(self.contentView).offset(-10);    }];        self.titleLB = [self createLb];    self.titleLB.font = [UIFont fontWithName:Rob_Bold size:16];    self.titleLB.numberOfLines =0;    self.titleLB.preferredMaxLayoutWidth = KScreenWidth-40-10-44;    [self.bgV addSubview:self.titleLB];    [self.titleLB mas_makeConstraints:^(MASConstraintMaker *make) {        make.top.equalTo(self.bgV).offset(20);        make.left.equalTo(self.bgV).offset(15);        make.width.mas_equalTo(KScreenWidth-40-10-44);    }];            self.editBt = [UIButton buttonWithType:UIButtonTypeCustom];    [self.editBt setImage:[UIImage imageNamed:@"avater_edit"] forState:UIControlStateNormal];    [self.editBt addTarget:self action:@selector(editBtnAction) forControlEvents:UIControlEventTouchUpInside];    [self.bgV addSubview:self.editBt];    [self.editBt mas_makeConstraints:^(MASConstraintMaker *make) {        make.width.height.equalTo(@44);        make.right.equalTo(self.bgV);        make.centerY.equalTo(self.bgV);    }];            self.checkBtn = [UIButton buttonWithType:UIButtonTypeCustom];    self.checkBtn.hidden = YES;    [self.checkBtn setImage:[UIImage imageNamed:@"cartship_radio_unselect"] forState:UIControlStateNormal];    [self.checkBtn setImage:[UIImage imageNamed:@"cartship_radio_select"] forState:UIControlStateSelected];    [self.checkBtn addTarget:self action:@selector(handle_checkBtnAction) forControlEvents:UIControlEventTouchUpInside];    [self.bgV addSubview:self.checkBtn];    [self.checkBtn mas_makeConstraints:^(MASConstraintMaker *make) {        make.height.equalTo(@44);        make.width.equalTo(@44);        make.right.equalTo(self.bgV);        make.centerY.equalTo(self.titleLB);    }];        UIStackView *tStackV = [[UIStackView alloc] init];    tStackV.axis = UILayoutConstraintAxisVertical;    tStackV.alignment = UIStackViewAlignmentFill;    tStackV.distribution = UIStackViewDistributionFill;    tStackV.spacing = 10;    [self.bgV addSubview:tStackV];    [tStackV mas_makeConstraints:^(MASConstraintMaker *make) {        make.top.equalTo(self.titleLB.mas_bottom).offset(15);        make.left.equalTo(self.bgV).offset(15);        make.right.equalTo(self.editBt.mas_left).offset(-15);        make.bottom.equalTo(self.bgV).offset(-20);    }];        self.nameLB = [self createLb];    [tStackV addArrangedSubview:self.nameLB];        self.addressLB = [self createLb];    [tStackV addArrangedSubview:self.addressLB];    self.addressLB.numberOfLines = 0;        self.codeLB = [self createLb];    [tStackV addArrangedSubview:self.codeLB];        self.countryLB = [self createLb];    [tStackV addArrangedSubview:self.countryLB];        self.phoneLB = [self createLb];    [tStackV addArrangedSubview:self.phoneLB];}- (void)editBtnAction {    if (self.editBack) {        self.editBack();    }}-(void)handle_checkBtnAction{    if(self.checkBack){        self.checkBack();    }}- (UILabel *)createLb {    UILabel *lb = [[UILabel alloc] init];    lb.font = [UIFont fontWithName:Rob_Regular size:14];    lb.textColor = UIColor.blackColor;    [lb mas_makeConstraints:^(MASConstraintMaker *make) {        make.height.greaterThanOrEqualTo(@14);    }];    return lb;}- (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
 |