WD_DetailCoaCell.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. //
  2. // WD_DetailCoaCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/8.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WD_DetailCoaCell.h"
  9. @interface WD_DetailCoaCell ()
  10. {
  11. UILabel *_nameLab;
  12. UILabel *_sexLab;
  13. UILabel *_levelLab;
  14. UILabel *_cardIdLab;
  15. UILabel *_addressLab;
  16. UILabel *_connectTelLab;
  17. UILabel *_carTypeLab;
  18. UIView *_view;
  19. UIView *_bottomView;
  20. }
  21. @end
  22. @implementation WD_DetailCoaCell
  23. +(WD_DetailCoaCell *)cellForTableView:(UITableView *)tableView{
  24. WD_DetailCoaCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailCoaCell"];
  25. if (!cell) {
  26. cell = [[WD_DetailCoaCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailCoaCell"];
  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. _nameLab = mArr[0];
  49. _levelLab = mArr[1];
  50. _sexLab = mArr[2];
  51. _cardIdLab = mArr[3];
  52. _addressLab = mArr[4];
  53. _carTypeLab = mArr[5];
  54. _connectTelLab = mArr[6];
  55. _levelLab.textAlignment = NSTextAlignmentRight;
  56. _sexLab.textAlignment = NSTextAlignmentCenter;
  57. _nameLab.textColor = COLOR_THEME;
  58. }
  59. return self;
  60. }
  61. -(void)setDic:(NSDictionary *)dic{
  62. if (_dic != dic) {
  63. _nameLab.text = dic[@"CI_NAME"];
  64. NSString *sex = [NSString stringWithFormat:@"%@",dic[@"CI_SEX"]];
  65. _sexLab.text = [sex isEqualToString:@"1"] ? @"男" : @"女" ;
  66. NSString *status = [NSString stringWithFormat:@"%@",dic[@"CI_OCCUPATIONLEVEL"]];
  67. NSString *levelStr = @"暂无";
  68. switch ([status integerValue]) {
  69. case 1:
  70. levelStr = @"一级";
  71. break;
  72. case 2:
  73. levelStr = @"二级";
  74. break;
  75. case 3:
  76. levelStr = @"三级";
  77. break;
  78. case 4:
  79. levelStr = @"四级";
  80. break;
  81. default:
  82. break;
  83. }
  84. _levelLab.text = [@"资格等级:" stringByAppendingString:levelStr];
  85. _cardIdLab.text = [NSString stringWithFormat:@"驾驶证号:%@",dic[@"CI_DRILICENCE"]];
  86. _addressLab.text = [NSString stringWithFormat:@"所属驾校:%@",dic[@"SCHOOLNAME"]];
  87. _connectTelLab.text =[NSString stringWithFormat:@"联系电话:%@",dic[@"CI_MOBILE"]];
  88. _carTypeLab.text =[NSString stringWithFormat:@"准教车型:%@",dic[@"CI_TEACHPERMITTED"]];
  89. }
  90. }
  91. -(void)layoutSubviews{
  92. [super layoutSubviews];
  93. CGFloat wid = self.width;
  94. CGFloat x,y,w,h,bd;
  95. x = -50;
  96. w = wid+50;
  97. y = 0;
  98. h = 10;
  99. _view.frame = setDIYFrame;
  100. x = 10;
  101. w = [_nameLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width;
  102. y = 20;
  103. h = 17;
  104. bd = 10;
  105. _nameLab.frame = setDIYFrame;
  106. w = [_sexLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width;
  107. _sexLab.frame = setDIYFrame;
  108. _sexLab.center = CGPointMake(wid/2-40, y+h/2);
  109. w = [_levelLab.text sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width;
  110. x = wid-w-10;
  111. _levelLab.frame = setDIYFrame;
  112. x = 10;
  113. w = wid-20;
  114. y += h+bd;
  115. _cardIdLab.frame = setDIYFrame;
  116. y += h+bd;
  117. _addressLab.frame = setDIYFrame;
  118. y += h+bd;
  119. _connectTelLab.frame = setDIYFrame;
  120. y += h+bd;
  121. _carTypeLab.frame = setDIYFrame;
  122. x = -50;
  123. w = wid+50;
  124. y +=10+h;
  125. h = 10;
  126. _bottomView.frame = setDIYFrame;
  127. //165
  128. }
  129. - (void)awakeFromNib {
  130. [super awakeFromNib];
  131. // Initialization code
  132. }
  133. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  134. [super setSelected:selected animated:animated];
  135. // Configure the view for the selected state
  136. }
  137. @end