RepListCell.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. //
  2. // RepListCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/5/31.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "RepListCell.h"
  9. #import "NSString+ex.h"
  10. @interface RepListCell()
  11. {
  12. UILabel *_title;
  13. UILabel *_content;
  14. UILabel *_dqmc;
  15. UILabel *_qxmc;
  16. UILabel *_replyContent;
  17. UILabel *_crTime;
  18. UILabel *_replyTime;
  19. UILabel *_tel;
  20. UIView * _view;
  21. }
  22. @end
  23. @implementation RepListCell
  24. +(RepListCell *)cellForTabelView:(UITableView *)tableView{
  25. RepListCell* cell = [tableView dequeueReusableCellWithIdentifier:@"RepListCell"];
  26. if (!cell) {
  27. cell = [[RepListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"RepListCell"];
  28. }
  29. return cell;
  30. }
  31. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  32. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  33. self.selectionStyle = UITableViewCellSelectionStyleNone;
  34. NSArray * textArr = @[@"标题",@"举报内容",@"dqmc",@"qxmc",@"回复内容",@"cr时间",@"回复时间",@"电话"];
  35. NSMutableArray * labArr = [NSMutableArray new];
  36. //
  37. for (int i=0; i<textArr.count; i++) {
  38. UILabel * lab = [[UILabel alloc]init];
  39. lab.textColor = [UIColor blackColor];
  40. lab.textAlignment = NSTextAlignmentLeft;
  41. lab.font = [UIFont systemFontOfSize:14];
  42. [self.contentView addSubview:lab];
  43. [labArr addObject:lab];
  44. }
  45. _title = labArr[0];
  46. _content = labArr[1];
  47. _dqmc = labArr[2];
  48. _qxmc = labArr[3];
  49. _replyContent = labArr[4];
  50. _crTime = labArr[5];
  51. _replyTime = labArr[6];
  52. _tel = labArr[7];
  53. _crTime.textAlignment = NSTextAlignmentRight;
  54. _crTime.textColor = [UIColor lightGrayColor];
  55. _crTime.font = [UIFont systemFontOfSize:12];
  56. _content.numberOfLines = 0;
  57. _view = [UIView new];
  58. _view.backgroundColor = KBackGroundColor;
  59. [self.contentView addSubview:_view];
  60. }
  61. return self;
  62. }
  63. - (void)layoutSubviews {
  64. [super layoutSubviews];
  65. [super layoutSubviews];
  66. CGFloat wid = self.width;
  67. CGFloat x,y,w,h,bd;
  68. x = 0;
  69. w = wid;
  70. y = 0;
  71. h = 20;
  72. _view.frame = setDIYFrame;
  73. x = 20;
  74. y += h+10;
  75. bd = 5;
  76. w = wid - 40;
  77. h = 17;
  78. _title.frame = setDIYFrame;
  79. y += h+bd;
  80. _tel.frame = setDIYFrame;
  81. y += h;
  82. h = [_content.text heightForWid:w Font:14];
  83. if (h != 0) {
  84. y += bd;
  85. }
  86. _content.frame = setDIYFrame;
  87. y += h+bd;
  88. h = 17;
  89. _crTime.frame = setDIYFrame;
  90. // y += h;
  91. // _dqmc.frame = setDIYFrame;
  92. //
  93. // y += h;
  94. // _qxmc.frame = setDIYFrame;
  95. //
  96. // y += h;
  97. // _replyContent.frame = setDIYFrame;
  98. //
  99. // y += h;
  100. // _replyTime.frame = setDIYFrame;
  101. }
  102. - (void)updateWithDic:(NSDictionary *)dic {
  103. _title.text = [NSString stringWithFormat:@"标题 :%@",dic[@"title"]];
  104. _tel.text = [NSString stringWithFormat:@"举报人电话 :%@",dic[@"tel"]];
  105. if ([dic[@"content"] length] != 0) {
  106. _content.text = [NSString stringWithFormat:@"举报内容 :%@",dic[@"content"]];
  107. }else{
  108. _content.text = @"";
  109. }
  110. _crTime.text = [NSString stringWithFormat:@"%@",dic[@"crTime"]];
  111. _dqmc.text = [NSString stringWithFormat:@"地区名称 :%@",dic[@"dqmc"]];
  112. _qxmc.text = [NSString stringWithFormat:@"区县名称 :%@",dic[@"qxmc"]];
  113. _replyContent.text = [NSString stringWithFormat:@"回复内容 :%@",dic[@"replyContent"]];
  114. _replyTime.text = [NSString stringWithFormat:@"回复时间 :%@",dic[@"replyTime"]];
  115. }
  116. - (void)awakeFromNib {
  117. [super awakeFromNib];
  118. // Initialization code
  119. }
  120. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  121. [super setSelected:selected animated:animated];
  122. // Configure the view for the selected state
  123. }
  124. @end