ChatNewRowCell.m 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. //
  2. // ChatNewRowCell.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2019/12/10.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "ChatNewRowCell.h"
  9. @implementation ChatNewRowCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  15. [super setSelected:selected animated:animated];
  16. // Configure the view for the selected state
  17. }
  18. + (CGFloat)configCell0Height{
  19. return 50;
  20. }
  21. + (CGFloat)configCell1Height{
  22. return 65;
  23. }
  24. + (CGFloat)configCell2Height{
  25. return 65;
  26. }
  27. + (ChatNewRowCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  28. static NSString *cellIdentifer = @"ChatNewRowCell0";
  29. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  30. if (cell == nil) {
  31. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:0];
  32. }
  33. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  34. cell.cell0SearchBgView.layer.masksToBounds = YES;
  35. cell.cell0SearchBgView.layer.cornerRadius = 15;
  36. cell.cell0SearchBgView.backgroundColor = RGB(245, 246, 248);
  37. return cell;
  38. }
  39. + (ChatNewRowCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  40. static NSString *cellIdentifer = @"ChatNewRowCell1";
  41. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  42. if (cell == nil) {
  43. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:1];
  44. }
  45. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  46. return cell;
  47. }
  48. + (ChatNewRowCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  49. static NSString *cellIdentifer = @"ChatNewRowCell2";
  50. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  51. if (cell == nil) {
  52. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:2];
  53. }
  54. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  55. cell.cell2TimeLabel.hidden = NO;
  56. return cell;
  57. }
  58. + (ChatNewRowCell *)configCell5:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  59. static NSString *cellIdentifer = @"ChatNewRowCell5";
  60. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  61. if (cell == nil) {
  62. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:7];
  63. }
  64. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  65. cell.cell2TimeLabel.hidden = NO;
  66. return cell;
  67. }
  68. + (ChatNewRowCell *)configCell50:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  69. static NSString *cellIdentifer = @"ChatNewRowCell50";
  70. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  71. if (cell == nil) {
  72. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:8];
  73. }
  74. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  75. cell.cell2TimeLabel.hidden = NO;
  76. return cell;
  77. }
  78. + (ChatNewRowCell *)configCell10:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  79. static NSString *cellIdentifer = @"ChatNewRowCell10";
  80. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  81. if (cell == nil) {
  82. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:3];
  83. }
  84. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  85. return cell;
  86. }
  87. + (ChatNewRowCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  88. static NSString *cellIdentifer = @"ChatNewRowCell20";
  89. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  90. if (cell == nil) {
  91. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:4];
  92. }
  93. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  94. cell.cell2TimeLabel.hidden = NO;
  95. return cell;
  96. }
  97. + (ChatNewRowCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  98. static NSString *cellIdentifer = @"ChatNewRowCell30";
  99. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  100. if (cell == nil) {
  101. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:5];
  102. }
  103. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  104. return cell;
  105. }
  106. + (ChatNewRowCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  107. static NSString *cellIdentifer = @"ChatNewRowCell40";
  108. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  109. if (cell == nil) {
  110. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:6];
  111. }
  112. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  113. return cell;
  114. }
  115. - (void)layoutSubviews
  116. {
  117. [super layoutSubviews];
  118. CGRect rect = self.contentView.frame;
  119. rect.size.width += rect.origin.x;
  120. rect.origin.x = 0;
  121. self.contentView.frame = rect;
  122. for (UIView *supView in self.subviews){
  123. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  124. for (UIView *view in supView.subviews)
  125. {
  126. if ([view isKindOfClass: [UIImageView class]])
  127. {
  128. view.hidden = !self.isSort;
  129. UIImageView * imagV = (UIImageView *)view;
  130. [imagV setFrame:CGRectMake(0, 0, 32, 20)];
  131. imagV.center = supView.center;
  132. imagV.contentMode = UIViewContentModeCenter;
  133. imagV.image = [UIImage imageNamed: @"list_sort"];
  134. UIView * label = [UIView new];
  135. label.backgroundColor = UIColorHex(0xEEEEEE);
  136. [supView addSubview:label];
  137. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  138. }else{
  139. view.hidden = YES;
  140. }
  141. }
  142. }
  143. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  144. [supView removeFromSuperview];
  145. }
  146. }
  147. }
  148. @end