ASOrderDetailsInfoCell.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. //
  2. // ASOrderDetailsInfoCell.m
  3. // Asteria
  4. //
  5. // Created by xingyu on 2024/5/15.
  6. //
  7. #import "ASOrderDetailsInfoCell.h"
  8. @interface ASOrderDetailsInfoCell()
  9. @property (nonatomic, strong) UIView *backView;
  10. @property (nonatomic, strong) UIView *lineView;
  11. @end
  12. @implementation ASOrderDetailsInfoCell
  13. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  14. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  15. self.selectionStyle = UITableViewCellSelectionStyleNone;
  16. self.contentView.backgroundColor = _F8F8F8;
  17. _backView = [[UIView alloc] init];
  18. _backView.backgroundColor = Col_FFF;
  19. TT_ViewRadius(_backView, 3);
  20. [self.contentView addSubview:_backView];
  21. [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.left.top.mas_equalTo(10);
  23. make.bottom.right.mas_equalTo(-10);
  24. // make.height.mas_equalTo(200);
  25. }];
  26. UILabel *infoLab = [UILabel labelCreateWithText:@"order information" font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B];
  27. [_backView addSubview:infoLab];
  28. [infoLab mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.mas_equalTo (10);
  30. make.top.mas_equalTo(28);
  31. }];
  32. _lineView = [[UIView alloc] init];
  33. _lineView.backgroundColor = _F4F4F4;
  34. [_backView addSubview:_lineView];
  35. [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  36. make.left.mas_equalTo(10);
  37. make.right.mas_equalTo(-10);
  38. make.height.mas_equalTo(1);
  39. make.top.equalTo(infoLab.mas_bottom).offset(22);
  40. }];
  41. }
  42. return self;
  43. }
  44. - (void)setOrderModel:(ASOrderDetailsModel *)orderModel {
  45. _orderModel = orderModel;
  46. NSArray *titleArray = @[@"ship to:", @"order number:", @"status:", @"order date:", @"shipping method:", @"Payment method:"];
  47. 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"];
  48. UILabel *tempLab = nil;
  49. for (int i = 0; i < titleArray.count; i++) {
  50. UILabel *rightLab = [UILabel labelCreateWithText:valueArray[i] font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B];
  51. rightLab.numberOfLines = 0;
  52. [_backView addSubview:rightLab];
  53. if (i == 0) {
  54. [rightLab mas_makeConstraints:^(MASConstraintMaker *make) {
  55. make.right.mas_equalTo(-10);
  56. make.left.mas_equalTo(140);
  57. make.top.mas_equalTo(_lineView.mas_bottom).offset(20);
  58. }];
  59. } else {
  60. [rightLab mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.right.mas_equalTo(-10);
  62. make.left.mas_equalTo(140);
  63. make.top.mas_equalTo(tempLab.mas_bottom).offset(20);
  64. }];
  65. }
  66. tempLab = rightLab;
  67. UILabel *leftLab = [UILabel labelCreateWithText:titleArray[i] font:[UIFont fontWithName:Rob_Regular size:12] textColor:_0B0B0B];
  68. [_backView addSubview:leftLab];
  69. [leftLab mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.mas_equalTo(10);
  71. make.centerY.mas_equalTo(rightLab);
  72. }];
  73. }
  74. UIView *lineView1 = [[UIView alloc] init];
  75. lineView1.backgroundColor = _F4F4F4;
  76. [_backView addSubview:lineView1];
  77. [lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.left.mas_equalTo(10);
  79. make.right.mas_equalTo(-10);
  80. make.height.mas_equalTo(1);
  81. make.top.equalTo(tempLab.mas_bottom).offset(20);
  82. make.bottom.mas_equalTo(-20);
  83. }];
  84. }
  85. @end