ComListCell.m 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. //
  2. // ComListCell.m
  3. // LNManager
  4. //
  5. // Created by EchoShacolee on 2017/5/31.
  6. // Copyright © 2017年 lee. All rights reserved.
  7. //
  8. #import "ComListCell.h"
  9. @interface ComListCell()
  10. {
  11. UILabel *_coach;
  12. UILabel *_school;
  13. UILabel *_deptopinion;
  14. UILabel *_schopinion;
  15. UILabel *_content;
  16. UILabel *_student;
  17. UILabel *_time;
  18. UIButton *_oneBtn;
  19. UIView *_view;
  20. }
  21. @end
  22. @implementation ComListCell
  23. +(ComListCell *)cellForTabelView:(UITableView *)tableView{
  24. ComListCell* cell = [tableView dequeueReusableCellWithIdentifier:@"ComListCell"];
  25. if (!cell) {
  26. cell = [[ComListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ComListCell"];
  27. }
  28. return cell;
  29. }
  30. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  31. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  32. self.selectionStyle = UITableViewCellSelectionStyleNone;
  33. self.contentView.backgroundColor = [UIColor whiteColor];
  34. NSArray * textArr = @[@"被投诉教练",@"机构名字",@"DEPTOPINION",@"SCHOPINION",@"评价内容",@"时间",@"学员"];
  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. _coach = labArr[0];
  46. _school = labArr[1];
  47. _deptopinion = labArr[2];
  48. _schopinion = labArr[3];
  49. _content = labArr[4];
  50. _time = labArr[5];
  51. _student = labArr[6];
  52. _time.textAlignment = NSTextAlignmentRight;
  53. _time.textColor = [UIColor lightGrayColor];
  54. _time.font = [UIFont systemFontOfSize:12];
  55. _content.numberOfLines = 0;
  56. _deptopinion.numberOfLines = 0;
  57. _schopinion.numberOfLines = 0;
  58. _oneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  59. [_oneBtn setTitle:@"处理" textColor:RQMianColor font:15 fotState:UIControlStateNormal];
  60. [_oneBtn borderColor:RQMianColor width:1 cornorRadios:5];
  61. [_oneBtn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  62. [self.contentView addSubview:_oneBtn];
  63. _view = [UIView new];
  64. _view.backgroundColor = KBackGroundColor;
  65. [self.contentView addSubview:_view];
  66. }
  67. return self;
  68. }
  69. - (void)updateWithDic:(NSDictionary *)dic {
  70. NSString *type = [NSString stringWithFormat:@"%@",dic[@"TYPE"]];
  71. if ([type isEqualToString:@"1"]) {
  72. _coach.text = [NSString stringWithFormat:@"被投诉教练 :%@",dic[@"OBJNAME"]];
  73. _school.text = [NSString stringWithFormat:@"所属机构 :%@",dic[@"OBJNAME"]];
  74. }else{
  75. _coach.text = @"";
  76. _school.text = [NSString stringWithFormat:@"被投诉机构 :%@",dic[@"OBJNAME"]];
  77. }
  78. NSString * timeStr = dic[@"CRTIME"];
  79. _time.text = [NSString stringWithFormat:@"%@",timeStr];
  80. if ([dic[@"CONTENT"] length] != 0) {
  81. _content.text = [NSString stringWithFormat:@"投诉内容 :%@",dic[@"CONTENT"]];
  82. }else{
  83. _content.text = @"";
  84. }
  85. if ([dic[@"SCHOPIONION"] length] != 0) {
  86. _schopinion.text = [NSString stringWithFormat:@"机构意见 :%@",dic[@"SCHOPIONION"]];
  87. }else{
  88. _schopinion.text = @"";
  89. }
  90. if ([dic[@"DEPAOPINION"] length] != 0) {
  91. _deptopinion.text = [NSString stringWithFormat:@"我的意见 :%@",dic[@"DEPAOPINION"]];
  92. }else{
  93. _deptopinion.text = @"";
  94. }
  95. _student.text = [NSString stringWithFormat:@"学员 :%@",dic[@"STUNAME"]];
  96. }
  97. - (void)layoutSubviews{
  98. CGFloat wid = self.width;
  99. CGFloat x,y,w,h,bd;
  100. x = 0;
  101. w = wid;
  102. y = 0;
  103. h = 20;
  104. _view.frame = KSetDIYFrame;
  105. y += 5;
  106. x = 20;
  107. y += h;
  108. bd = 5;
  109. w = wid - 40;
  110. h = 17;
  111. y += bd;
  112. _coach.frame = KSetDIYFrame;
  113. _time.frame = KSetDIYFrame;
  114. y += h+bd;
  115. h = 17;
  116. _school.frame = KSetDIYFrame;
  117. if (_time.frame.size.height == 0) {
  118. _time.frame = KSetDIYFrame;
  119. }
  120. y += h;
  121. h = [_content.text heightForWid:w Font:14];
  122. if (h != 0) {
  123. y += bd;
  124. }
  125. _content.frame = KSetDIYFrame;
  126. y += h;
  127. h = [_schopinion.text heightForWid:w Font:14];
  128. if (h != 0) {
  129. y += bd;
  130. }
  131. _schopinion.frame = KSetDIYFrame;
  132. y += h;
  133. h = [_deptopinion.text heightForWid:w Font:14];
  134. if (h != 0) {
  135. y += bd;
  136. }
  137. _deptopinion.frame = KSetDIYFrame;
  138. y += h+bd;
  139. x = wid-70;
  140. h = 25;
  141. w = 50;
  142. _oneBtn.frame = KSetDIYFrame;
  143. // y += h;
  144. // _student.frame = KSetDIYFrame;
  145. }
  146. -(void)btnClick:(UIButton *)sender{
  147. if (self.block) {
  148. self.block();
  149. }
  150. }
  151. - (void)awakeFromNib {
  152. [super awakeFromNib];
  153. // Initialization code
  154. }
  155. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  156. [super setSelected:selected animated:animated];
  157. // Configure the view for the selected state
  158. }
  159. @end