// // ASOrderDetailsInfoCell.m // Asteria // // Created by xingyu on 2024/5/15. // #import "ASOrderDetailsInfoCell.h" @interface ASOrderDetailsInfoCell() @property (nonatomic, strong) UIView *backView; @property (nonatomic, strong) UIView *lineView; @end @implementation ASOrderDetailsInfoCell - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle = UITableViewCellSelectionStyleNone; self.contentView.backgroundColor = _F8F8F8; _backView = [[UIView alloc] init]; _backView.backgroundColor = Col_FFF; TT_ViewRadius(_backView, 3); [self.contentView addSubview:_backView]; [_backView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.mas_equalTo(10); make.bottom.right.mas_equalTo(-10); // make.height.mas_equalTo(200); }]; UILabel *infoLab = [UILabel labelCreateWithText:@"order information" font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B]; [_backView addSubview:infoLab]; [infoLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo (10); make.top.mas_equalTo(28); }]; _lineView = [[UIView alloc] init]; _lineView.backgroundColor = _F4F4F4; [_backView addSubview:_lineView]; [_lineView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-10); make.height.mas_equalTo(1); make.top.equalTo(infoLab.mas_bottom).offset(22); }]; } return self; } - (void)setOrderModel:(ASOrderDetailsModel *)orderModel { _orderModel = orderModel; NSArray *titleArray = @[@"ship to:", @"order number:", @"status:", @"order date:", @"shipping method:", @"Payment method:"]; NSArray *valueArray = @[@"Alessandro 6263378809 12941 Ramona Blvd Unit A&B Irwindale Arizona 91706 United States", @"600465290", @"Processing", @"September 24,2020", @"Same day delivery (Order before 10:30 am)", @"Paypal-express"]; UILabel *tempLab = nil; for (int i = 0; i < titleArray.count; i++) { UILabel *rightLab = [UILabel labelCreateWithText:valueArray[i] font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B]; rightLab.numberOfLines = 0; [_backView addSubview:rightLab]; if (i == 0) { [rightLab mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.left.mas_equalTo(140); make.top.mas_equalTo(_lineView.mas_bottom).offset(20); }]; } else { [rightLab mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-10); make.left.mas_equalTo(140); make.top.mas_equalTo(tempLab.mas_bottom).offset(20); }]; } tempLab = rightLab; UILabel *leftLab = [UILabel labelCreateWithText:titleArray[i] font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B]; [_backView addSubview:leftLab]; [leftLab mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.centerY.mas_equalTo(rightLab); }]; } UIView *lineView1 = [[UIView alloc] init]; lineView1.backgroundColor = _F4F4F4; [_backView addSubview:lineView1]; [lineView1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(10); make.right.mas_equalTo(-10); make.height.mas_equalTo(1); make.top.equalTo(tempLab.mas_bottom).offset(20); make.bottom.mas_equalTo(-20); }]; } @end