WD_DetailChangeCell.m 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // WD_DetailChangeCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/6/13.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "WD_DetailChangeCell.h"
  9. #import "NSString+ex.h"
  10. @interface WD_DetailChangeCell ()
  11. {
  12. UIView *_view;
  13. UIView *_bottomView;
  14. }
  15. @property (strong, nonatomic) UILabel *nameLab;
  16. @property (strong, nonatomic) UILabel *outSchLab;
  17. @property (strong, nonatomic) UILabel *inSchLab;
  18. @property (strong, nonatomic) UILabel *timelab;
  19. @property (strong, nonatomic) UILabel *reasonLab;
  20. @end
  21. @implementation WD_DetailChangeCell
  22. +(WD_DetailChangeCell *)cellForTableView:(UITableView *)tableView{
  23. WD_DetailChangeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"WD_DetailChangeCell"];
  24. if (!cell) {
  25. cell = [[WD_DetailChangeCell alloc]initWithStyle:0 reuseIdentifier:@"WD_DetailChangeCell"];
  26. }
  27. return cell;
  28. }
  29. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  30. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  31. self.tintColor = COLOR_THEME;
  32. NSMutableArray *mArr = [NSMutableArray new];
  33. for (int i=0; i<5; i++) {
  34. UILabel *lab = [[UILabel alloc]init];
  35. lab.font = [UIFont systemFontOfSize:14];
  36. [mArr addObject:lab];
  37. [self.contentView addSubview:lab];
  38. }
  39. _nameLab = mArr[0];
  40. _outSchLab = mArr[1];
  41. _inSchLab = mArr[2];
  42. _timelab = mArr[3];
  43. _reasonLab = mArr[4];
  44. _view = [UIView new];
  45. _view.backgroundColor = KBackGroundColor;
  46. [self.contentView addSubview:_view];
  47. _bottomView = [UIView new];
  48. _bottomView.backgroundColor = KBackGroundColor;
  49. [self.contentView addSubview:_bottomView];
  50. _reasonLab.numberOfLines = 0;
  51. self.nameLab.textColor = COLOR_THEME;
  52. }
  53. return self;
  54. }
  55. -(void)setDic:(NSDictionary *)dic{
  56. _dic = dic;
  57. _nameLab.text = dic[@"STUDNETNAME"];
  58. _outSchLab.text = [NSString stringWithFormat:@"转出学校:%@",dic[@"OUTSCHOOLNAME"]];
  59. _inSchLab.text = [NSString stringWithFormat:@"转入学校:%@",dic[@"INSCHOOLNAME"]];
  60. _timelab.text = [NSString stringWithFormat:@"申请时间:%@",dic[@"SCS_IN_OPERATE_TIME"]];
  61. _reasonLab.text = [NSString stringWithFormat:@"申请原因:%@",dic[@"SCS_CHANGE_REASON"]];
  62. }
  63. -(void)layoutSubviews{
  64. [super layoutSubviews];
  65. CGFloat wid = self.width;
  66. CGFloat x,y,w,h,bd;
  67. x = -50;
  68. w = wid+50;
  69. y = 0;
  70. h = 10;
  71. _view.frame = setDIYFrame;
  72. x = 10;
  73. w = wid-20;
  74. y = 20;
  75. h = 17;
  76. bd = 10;
  77. _nameLab.frame = setDIYFrame;
  78. y += h+bd;
  79. _outSchLab.frame = setDIYFrame;
  80. y += h+bd;
  81. _inSchLab.frame = setDIYFrame;
  82. y += h+bd;
  83. _timelab.frame = setDIYFrame;
  84. y += h+bd;
  85. h = [_reasonLab.text heightForWid:w Font:14];
  86. _reasonLab.frame = setDIYFrame;
  87. x = -50;
  88. w = wid+50;
  89. y +=10+h;
  90. h = 10;
  91. _bottomView.frame = setDIYFrame;
  92. //165-17
  93. }
  94. - (void)awakeFromNib {
  95. [super awakeFromNib];
  96. // Initialization code
  97. }
  98. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  99. [super setSelected:selected animated:animated];
  100. // Configure the view for the selected state
  101. }
  102. @end