ChatNewRowCell.m 5.8 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.cell0SearchBgView.layer.masksToBounds = YES;
  34. cell.cell0SearchBgView.layer.cornerRadius = 15;
  35. cell.cell0SearchBgView.backgroundColor = RGB(245, 246, 248);
  36. return cell;
  37. }
  38. + (ChatNewRowCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  39. static NSString *cellIdentifer = @"ChatNewRowCell1";
  40. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  41. if (cell == nil) {
  42. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:1];
  43. }
  44. return cell;
  45. }
  46. + (ChatNewRowCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  47. static NSString *cellIdentifer = @"ChatNewRowCell2";
  48. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  49. if (cell == nil) {
  50. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:2];
  51. }
  52. cell.cell2TimeLabel.hidden = NO;
  53. return cell;
  54. }
  55. + (ChatNewRowCell *)configCell5:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  56. static NSString *cellIdentifer = @"ChatNewRowCell5";
  57. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  58. if (cell == nil) {
  59. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:7];
  60. }
  61. cell.cell2TimeLabel.hidden = NO;
  62. return cell;
  63. }
  64. + (ChatNewRowCell *)configCell50:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  65. static NSString *cellIdentifer = @"ChatNewRowCell50";
  66. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  67. if (cell == nil) {
  68. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:8];
  69. }
  70. cell.cell2TimeLabel.hidden = NO;
  71. return cell;
  72. }
  73. + (ChatNewRowCell *)configCell10:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  74. static NSString *cellIdentifer = @"ChatNewRowCell10";
  75. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  76. if (cell == nil) {
  77. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:3];
  78. }
  79. return cell;
  80. }
  81. + (ChatNewRowCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  82. static NSString *cellIdentifer = @"ChatNewRowCell20";
  83. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  84. if (cell == nil) {
  85. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:4];
  86. }
  87. cell.cell2TimeLabel.hidden = NO;
  88. return cell;
  89. }
  90. + (ChatNewRowCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  91. static NSString *cellIdentifer = @"ChatNewRowCell30";
  92. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  93. if (cell == nil) {
  94. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:5];
  95. }
  96. return cell;
  97. }
  98. + (ChatNewRowCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  99. static NSString *cellIdentifer = @"ChatNewRowCell40";
  100. ChatNewRowCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  101. if (cell == nil) {
  102. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatNewRowCell" owner:nil options:nil] objectAtIndex:6];
  103. }
  104. return cell;
  105. }
  106. - (void)layoutSubviews
  107. {
  108. [super layoutSubviews];
  109. CGRect rect = self.contentView.frame;
  110. rect.size.width += rect.origin.x;
  111. rect.origin.x = 0;
  112. self.contentView.frame = rect;
  113. for (UIView *supView in self.subviews){
  114. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  115. for (UIView *view in supView.subviews)
  116. {
  117. if ([view isKindOfClass: [UIImageView class]])
  118. {
  119. view.hidden = !self.isSort;
  120. UIImageView * imagV = (UIImageView *)view;
  121. [imagV setFrame:CGRectMake(0, 0, 32, 20)];
  122. imagV.center = supView.center;
  123. imagV.contentMode = UIViewContentModeCenter;
  124. imagV.image = [UIImage imageNamed: @"list_sort"];
  125. UIView * label = [UIView new];
  126. label.backgroundColor = UIColorHex(0xEEEEEE);
  127. [supView addSubview:label];
  128. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  129. }else{
  130. view.hidden = YES;
  131. }
  132. }
  133. }
  134. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  135. [supView removeFromSuperview];
  136. }
  137. }
  138. }
  139. @end