ChatMsgNoticeCell.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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.selectionStyle = UITableViewCellSelectionStyleNone;
  35. cell.cell0SearchBgView.layer.masksToBounds = YES;
  36. cell.cell0SearchBgView.layer.cornerRadius = 29.5/2.0;
  37. cell.cell0SearchBgView.backgroundColor = RGB(245, 246, 248);
  38. return cell;
  39. }
  40. + (ChatMsgNoticeCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  41. static NSString *cellIdentifer = @"ChatMsgNoticeCell1";
  42. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  43. if (cell == nil) {
  44. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:1];
  45. }
  46. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  47. return cell;
  48. }
  49. + (ChatMsgNoticeCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  50. static NSString *cellIdentifer = @"ChatMsgNoticeCell2";
  51. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  52. if (cell == nil) {
  53. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:2];
  54. }
  55. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  56. cell.cell2RedBgView.layer.masksToBounds = YES;
  57. cell.cell2RedBgView.layer.cornerRadius = 5.f;
  58. cell.cell2RedBgView.hidden = YES;
  59. cell.cell2EditBtn.hidden = YES;
  60. [cell.cell2EditBtn setTitle:@"编辑" forState:UIControlStateNormal];
  61. return cell;
  62. }
  63. + (ChatMsgNoticeCell *)configCell10:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  64. static NSString *cellIdentifer = @"ChatMsgNoticeCell10";
  65. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  66. if (cell == nil) {
  67. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:3];
  68. }
  69. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  70. cell.isShow = YES;
  71. cell.rightImageView.hidden = YES;
  72. return cell;
  73. }
  74. + (ChatMsgNoticeCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  75. static NSString *cellIdentifer = @"ChatMsgNoticeCell20";
  76. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  77. if (cell == nil) {
  78. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:4];
  79. }
  80. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  81. cell.cell2RedBgView.layer.masksToBounds = YES;
  82. cell.cell2RedBgView.layer.cornerRadius = 5.f;
  83. cell.cell2RedBgView.hidden = YES;
  84. cell.rightImageView.hidden = YES;
  85. cell.cell2EditBtn.hidden = YES;
  86. [cell.cell2EditBtn setTitle:@"编辑" forState:UIControlStateNormal];
  87. return cell;
  88. }
  89. + (ChatMsgNoticeCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  90. static NSString *cellIdentifer = @"ChatMsgNoticeCell30";
  91. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  92. if (cell == nil) {
  93. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:5];
  94. }
  95. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  96. return cell;
  97. }
  98. + (ChatMsgNoticeCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  99. static NSString *cellIdentifer = @"ChatMsgNoticeCell40";
  100. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  101. if (cell == nil) {
  102. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:6];
  103. }
  104. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  105. return cell;
  106. }
  107. + (ChatMsgNoticeCell *)configCell50:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  108. static NSString *cellIdentifer = @"ChatMsgNoticeCell50";
  109. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  110. if (cell == nil) {
  111. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:7];
  112. }
  113. cell.yanRedNumL.layer.cornerRadius = 8.f;
  114. cell.yanRedNumL.layer.masksToBounds = YES;
  115. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  116. return cell;
  117. }
  118. + (ChatMsgNoticeCell *)configCell60:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  119. static NSString *cellIdentifer = @"ChatMsgNoticeCell60";
  120. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  121. if (cell == nil) {
  122. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:8];
  123. }
  124. cell.yanRedNumL.layer.cornerRadius = 8.f;
  125. cell.yanRedNumL.layer.masksToBounds = YES;
  126. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  127. return cell;
  128. }
  129. - (void)layoutSubviews
  130. {
  131. [super layoutSubviews];
  132. CGRect rect = self.contentView.frame;
  133. rect.size.width += rect.origin.x;
  134. rect.origin.x = 0;
  135. self.contentView.frame = rect;
  136. for (UIView *supView in self.subviews){
  137. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  138. for (UIView *view in supView.subviews)
  139. {
  140. if ([view isKindOfClass: [UIImageView class]] && self.isShow)
  141. {
  142. view.hidden = NO;
  143. UIImageView * imagV = (UIImageView *)view;
  144. [imagV setFrame:CGRectMake(0, 0, 22, 18)];
  145. imagV.center = supView.center;
  146. imagV.contentMode = UIViewContentModeCenter;
  147. imagV.image = [UIImage imageNamed: @"list_sort"];
  148. UILabel * label = [UILabel new];
  149. label.backgroundColor = UIColorHex(#EAEAEA);
  150. [supView addSubview:label];
  151. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  152. }else{
  153. view.hidden = YES;
  154. }
  155. }
  156. }
  157. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  158. [supView removeFromSuperview];
  159. }
  160. }
  161. }
  162. @end