WD_DetailCarCell.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //
  2. // WD_DetailCarCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/8.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WD_DetailCarCell.h"
  9. @interface WD_DetailCarCell ()
  10. {
  11. UILabel * _rollsRoyce;
  12. UILabel * _schLab;
  13. UILabel * _addressLab;
  14. UILabel * _engNumLab;
  15. UILabel * _fraNumLab;
  16. UILabel * _licNumLab;
  17. UILabel * _perdritypeLab;
  18. UIView *_view;
  19. UIView *_bottomView;
  20. }
  21. @end
  22. @implementation WD_DetailCarCell
  23. +(WD_DetailCarCell *)cellForTableView:(UITableView *)tableView{
  24. WD_DetailCarCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailCarCell"];
  25. if (!cell) {
  26. cell = [[WD_DetailCarCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailCarCell"];
  27. }
  28. return cell;
  29. }
  30. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  31. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  32. if (self) {
  33. self.tintColor = COLOR_THEME;
  34. _view = [UIView new];
  35. _view.backgroundColor = KBackGroundColor;
  36. [self.contentView addSubview:_view];
  37. _bottomView = [UIView new];
  38. _bottomView.backgroundColor = KBackGroundColor;
  39. [self.contentView addSubview:_bottomView];
  40. //
  41. NSMutableArray *mArr = [NSMutableArray new];
  42. for (int i=0; i<7; i++) {
  43. UILabel *lab = [[UILabel alloc]init];
  44. lab.font = [UIFont systemFontOfSize:14];
  45. [mArr addObject:lab];
  46. [self.contentView addSubview:lab];
  47. }
  48. _rollsRoyce = mArr[0];
  49. _addressLab = mArr[1];
  50. _fraNumLab = mArr[2];
  51. _engNumLab = mArr[3];
  52. _licNumLab = mArr[4];
  53. _schLab = mArr[5];
  54. _perdritypeLab = mArr[6];
  55. _rollsRoyce.textAlignment = NSTextAlignmentRight;
  56. _engNumLab.textAlignment = NSTextAlignmentRight;
  57. _licNumLab.backgroundColor = RGB_COLOR(247, 196, 5);
  58. _licNumLab.textAlignment = NSTextAlignmentCenter;
  59. // _rollsRoyce.textColor = COLOR_THEME;
  60. }
  61. return self;
  62. }
  63. -(void)setDic:(NSDictionary *)dic{
  64. _dic = dic;
  65. _licNumLab.text = dic[@"TCO_LICNUM"];
  66. _rollsRoyce.text = dic[@"TCO_BRAND"];
  67. _schLab.text = [NSString stringWithFormat:@"所属驾校:%@",dic[@"SCHOOLNAME"]];
  68. _addressLab.text = [NSString stringWithFormat:@"所属地区:%@%@",dic[@"DQMC"],dic[@"QXMC"]];
  69. _engNumLab.text = [NSString stringWithFormat:@"发动机号:%@",dic[@"TCO_ENGNUM"]];
  70. if ([dic[@"TCO_FRANUM"] length] != 0) {
  71. _fraNumLab.text =[NSString stringWithFormat:@"车架号:%@",dic[@"TCO_FRANUM"]];
  72. }
  73. _perdritypeLab.text = [NSString stringWithFormat:@"培训车型:%@",dic[@"TCO_PERDRITYPE"]];
  74. }
  75. -(void)layoutSubviews{
  76. [super layoutSubviews];
  77. CGFloat wid = self.width;
  78. CGFloat x,y,w,h,bd;
  79. x = -50;
  80. w = wid+50;
  81. y = 0;
  82. h = 10;
  83. _view.frame = setDIYFrame;
  84. x = 10;
  85. w = [_licNumLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width+10;
  86. y = 20;
  87. h = 17;
  88. bd = 10;
  89. _licNumLab.frame = setDIYFrame;
  90. w = wid-20-10;
  91. _rollsRoyce.frame = setDIYFrame;
  92. y += h+bd;
  93. w = [_perdritypeLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width;
  94. _perdritypeLab.frame = setDIYFrame;
  95. w = wid-20;
  96. _engNumLab.frame = setDIYFrame;
  97. y += h+bd;
  98. _schLab.frame = setDIYFrame;
  99. y += h+bd;
  100. _addressLab.frame = setDIYFrame;
  101. x = -50;
  102. w = wid+50;
  103. y +=10+h;
  104. h = 10;
  105. _bottomView.frame = setDIYFrame;
  106. //138
  107. }
  108. - (void)awakeFromNib {
  109. [super awakeFromNib];
  110. // Initialization code
  111. }
  112. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  113. [super setSelected:selected animated:animated];
  114. // Configure the view for the selected state
  115. }
  116. @end