ChatNewRowCell.m 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 *)configCell3:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  59. static NSString *cellIdentifer = @"ChatNewRowCell3";
  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 *)configCell10:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  69. static NSString *cellIdentifer = @"ChatNewRowCell10";
  70. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  71. if (cell == nil) {
  72. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:3];
  73. }
  74. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  75. return cell;
  76. }
  77. + (ChatNewRowCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  78. static NSString *cellIdentifer = @"ChatNewRowCell20";
  79. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  80. if (cell == nil) {
  81. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:4];
  82. }
  83. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  84. cell.cell2TimeLabel.hidden = NO;
  85. return cell;
  86. }
  87. + (ChatNewRowCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  88. static NSString *cellIdentifer = @"ChatNewRowCell30";
  89. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  90. if (cell == nil) {
  91. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:5];
  92. }
  93. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  94. return cell;
  95. }
  96. + (ChatNewRowCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  97. static NSString *cellIdentifer = @"ChatNewRowCell40";
  98. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  99. if (cell == nil) {
  100. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:6];
  101. }
  102. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  103. return cell;
  104. }
  105. - (void)layoutSubviews
  106. {
  107. [super layoutSubviews];
  108. CGRect rect = self.contentView.frame;
  109. rect.size.width += rect.origin.x;
  110. rect.origin.x = 0;
  111. self.contentView.frame = rect;
  112. for (UIView *supView in self.subviews){
  113. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  114. for (UIView *view in supView.subviews)
  115. {
  116. if ([view isKindOfClass: [UIImageView class]])
  117. {
  118. UIImageView * imagV = (UIImageView *)view;
  119. [imagV setFrame:CGRectMake(0, 0, 32, 20)];
  120. imagV.center = supView.center;
  121. imagV.contentMode = UIViewContentModeCenter;
  122. imagV.image = [UIImage imageNamed: @"sort_icon"];
  123. UILabel * label = [UILabel new];
  124. label.backgroundColor = UIColorHex(#EAEAEA);
  125. [supView addSubview:label];
  126. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  127. }else{
  128. [view removeFromSuperview];
  129. }
  130. }
  131. supView.hidden = NO;
  132. if (!self.isSort) {
  133. supView.hidden = YES;
  134. }
  135. }
  136. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  137. [supView removeFromSuperview];
  138. }
  139. }
  140. }
  141. @end