ChatMsgNoticeCell.m 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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.rightImageView.hidden = YES;
  71. return cell;
  72. }
  73. + (ChatMsgNoticeCell *)configCell20:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  74. static NSString *cellIdentifer = @"ChatMsgNoticeCell20";
  75. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  76. if (cell == nil) {
  77. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:4];
  78. }
  79. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  80. cell.cell2RedBgView.layer.masksToBounds = YES;
  81. cell.cell2RedBgView.layer.cornerRadius = 5.f;
  82. cell.cell2RedBgView.hidden = YES;
  83. cell.rightImageView.hidden = YES;
  84. cell.cell2EditBtn.hidden = YES;
  85. [cell.cell2EditBtn setTitle:@"编辑" forState:UIControlStateNormal];
  86. return cell;
  87. }
  88. + (ChatMsgNoticeCell *)configCell30:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  89. static NSString *cellIdentifer = @"ChatMsgNoticeCell30";
  90. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  91. if (cell == nil) {
  92. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:5];
  93. }
  94. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  95. return cell;
  96. }
  97. + (ChatMsgNoticeCell *)configCell40:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  98. static NSString *cellIdentifer = @"ChatMsgNoticeCell40";
  99. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  100. if (cell == nil) {
  101. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:6];
  102. }
  103. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  104. return cell;
  105. }
  106. + (ChatMsgNoticeCell *)configCell50:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  107. static NSString *cellIdentifer = @"ChatMsgNoticeCell50";
  108. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  109. if (cell == nil) {
  110. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:7];
  111. }
  112. cell.yanRedNumL.layer.cornerRadius = 8.f;
  113. cell.yanRedNumL.layer.masksToBounds = YES;
  114. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  115. return cell;
  116. }
  117. + (ChatMsgNoticeCell *)configCell60:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  118. static NSString *cellIdentifer = @"ChatMsgNoticeCell60";
  119. ChatMsgNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  120. if (cell == nil) {
  121. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgNoticeCell" owner:nil options:nil] objectAtIndex:8];
  122. }
  123. cell.yanRedNumL.layer.cornerRadius = 8.f;
  124. cell.yanRedNumL.layer.masksToBounds = YES;
  125. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  126. return cell;
  127. }
  128. - (void)layoutSubviews
  129. {
  130. [super layoutSubviews];
  131. CGRect rect = self.contentView.frame;
  132. rect.size.width += rect.origin.x;
  133. rect.origin.x = 0;
  134. self.contentView.frame = rect;
  135. for (UIView *supView in self.subviews){
  136. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellReorderControl")]){
  137. for (UIView *view in supView.subviews)
  138. {
  139. if ([view isKindOfClass: [UIImageView class]])
  140. {
  141. view.hidden = !self.isShow;
  142. UIImageView * imagV = (UIImageView *)view;
  143. [imagV setFrame:CGRectMake(0, 0, 32, 20)];
  144. imagV.center = supView.center;
  145. imagV.contentMode = UIViewContentModeCenter;
  146. imagV.image = [UIImage imageNamed: @"list_sort"];
  147. UIView * label = [UIView new];
  148. label.backgroundColor = UIColorHex(0xEEEEEE);
  149. [supView addSubview:label];
  150. [label setFrame:CGRectMake(0, supView.frame.size.height - 0.5, supView.frame.size.width, 0.5)];
  151. }else{
  152. view.hidden = YES;
  153. }
  154. }
  155. }
  156. if ([supView isKindOfClass:NSClassFromString(@"UITableViewCellEditControl")]){
  157. [supView removeFromSuperview];
  158. }
  159. }
  160. }
  161. @end