ChatMsgNoticeCell.m 6.5 KB

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