WD_DetailSchCell.m 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. //
  2. // WD_DetailSchCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/8.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WD_DetailSchCell.h"
  9. @interface WD_DetailSchCell ()
  10. {
  11. UIImageView *_headImgV;
  12. UILabel *_schNameLab;
  13. UILabel *_levelLab;
  14. UILabel *_farenManLab;
  15. UILabel *_dqQxLab;
  16. UILabel *_cNumLab;
  17. UILabel *_connectManLab;
  18. UILabel *_connectTelLab;
  19. UIView *_view;
  20. UIView *_bottomView;
  21. }
  22. @end
  23. @implementation WD_DetailSchCell
  24. +(WD_DetailSchCell *)cellForTableView:(UITableView *)tableView{
  25. WD_DetailSchCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailSchCell"];
  26. if (!cell) {
  27. cell = [[WD_DetailSchCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailSchCell"];
  28. }
  29. return cell;
  30. }
  31. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  32. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  33. if (self) {
  34. self.tintColor = COLOR_THEME;
  35. _headImgV = [[UIImageView alloc]init];
  36. [self.contentView addSubview:_headImgV];
  37. _view = [UIView new];
  38. _view.backgroundColor = KBackGroundColor;
  39. [self.contentView addSubview:_view];
  40. // _bottomView = [UIView new];
  41. // _bottomView.backgroundColor = KBackGroundColor;
  42. // [self.contentView addSubview:_bottomView];
  43. //
  44. NSMutableArray *mArr = [NSMutableArray new];
  45. for (int i=0; i<7; i++) {
  46. UILabel *lab = [[UILabel alloc]init];
  47. lab.font = [UIFont systemFontOfSize:14];
  48. [mArr addObject:lab];
  49. [self.contentView addSubview:lab];
  50. }
  51. _schNameLab = mArr[0];
  52. _levelLab = mArr[1];
  53. _farenManLab = mArr[2];
  54. _dqQxLab = mArr[3];
  55. _cNumLab = mArr[4];
  56. _connectManLab = mArr[5];
  57. _connectTelLab = mArr[6];
  58. _levelLab.textAlignment = NSTextAlignmentRight;
  59. _cNumLab.textAlignment = NSTextAlignmentRight;
  60. _connectTelLab.textAlignment = NSTextAlignmentRight;
  61. _schNameLab.font = [UIFont systemFontOfSize:16];
  62. _schNameLab.textColor = COLOR_THEME;
  63. }
  64. return self;
  65. }
  66. -(void)setDic:(NSDictionary *)dic{
  67. if (_dic != dic) {
  68. [_headImgV sd_setImageWithURL:[NSURL URLWithString:dic[@"TIS_IMG"]] placeholderImage:[UIImage imageNamed:@"willDo_default"]];
  69. _schNameLab.text = dic[@"TSI_SHORTNAME"];
  70. NSString *status = [NSString stringWithFormat:@"%@",dic[@"TSI_LEVEL"]];
  71. NSString *levelStr = @"暂无";
  72. switch ([status integerValue]) {
  73. case 1:
  74. levelStr = @"一级";
  75. break;
  76. case 2:
  77. levelStr = @"二级";
  78. break;
  79. case 3:
  80. levelStr = @"三级";
  81. break;
  82. case 4:
  83. levelStr = @"四级";
  84. break;
  85. default:
  86. break;
  87. }
  88. _levelLab.text = [@"分类等级:" stringByAppendingString:levelStr];
  89. _farenManLab.text = [NSString stringWithFormat:@"法人:%@",dic[@"TSI_LEGAL"]];
  90. _dqQxLab.text = [NSString stringWithFormat:@"所属地区:%@ %@",dic[@"TSI_DQMC"],dic[@"TSI_QXMC"]];
  91. _cNumLab.text = [NSString stringWithFormat:@"经营范围:%@",dic[@"TSI_BUSISCOPE"]];
  92. _connectManLab.text = [NSString stringWithFormat:@"联系人:%@",dic[@"TSI_CONTACT"]];
  93. _connectTelLab.text =[NSString stringWithFormat:@"联系电话:%@",dic[@"TSI_PHONE"]];
  94. }
  95. }
  96. -(void)layoutSubviews{
  97. [super layoutSubviews];
  98. CGFloat wid = self.width;
  99. CGFloat x,y,w,h;
  100. x = 0;
  101. w = wid;
  102. y = 0;
  103. h = 20;
  104. _view.frame = setDIYFrame;
  105. x = 10;
  106. y = 30;
  107. w = 80;
  108. h = 70;
  109. _headImgV.frame = setDIYFrame;
  110. // _headImgV.center = CGPointMake(40, 69);
  111. x += w + 10;
  112. w = wid - x - 20;
  113. h = 25;
  114. _schNameLab.frame = setDIYFrame;
  115. CGFloat ff = [_schNameLab sizeThatFits:CGSizeMake(MAXFLOAT, h)].width;
  116. x += ff;
  117. w -= ff;
  118. _levelLab.frame = setDIYFrame;
  119. x -= ff;
  120. w += ff;
  121. y += h;
  122. _farenManLab.frame = setDIYFrame;
  123. ff = [_farenManLab.text widthForFont:16];//
  124. x += ff;
  125. w -= ff;
  126. _cNumLab.frame = setDIYFrame;
  127. x -= ff;
  128. w += ff;
  129. y += h;
  130. _dqQxLab.frame = setDIYFrame;
  131. x = 10;
  132. w = wid - 30;
  133. y += h;
  134. _connectManLab.frame = setDIYFrame;
  135. _connectTelLab.frame = setDIYFrame;
  136. // x = -50;
  137. // w = wid+50;
  138. // y +=10+h;
  139. // h = 10;
  140. // _bottomView.frame = setDIYFrame;
  141. }
  142. - (void)awakeFromNib {
  143. [super awakeFromNib];
  144. // Initialization code
  145. }
  146. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  147. [super setSelected:selected animated:animated];
  148. // Configure the view for the selected state
  149. }
  150. @end