ChatMsgDetailChatCell.m 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // ChatMsgDetailChatCell.m
  3. // smartRhino
  4. //
  5. // Created by armin on 2019/11/7.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "ChatMsgDetailChatCell.h"
  9. @implementation ChatMsgDetailChatCell
  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 47 + 15;
  23. }
  24. + (CGFloat)configCell2HeightWithContent:(NSString *)content{
  25. CGFloat oneLineMaxW = SCREEN_WIDTH - (81+87);
  26. CGSize size = [content sizeWithFont:[UIFont systemFontOfSize:16] byWidth:oneLineMaxW textLineSpacing:5];
  27. if(size.height <= 40){
  28. return 40 + 15;
  29. }else{
  30. return size.height + 15 + 14*2;
  31. }
  32. }
  33. + (CGFloat)configCell3HeightWithContent:(NSString *)content{
  34. CGFloat oneLineMaxW = SCREEN_WIDTH - (81+87);
  35. CGSize size = [content sizeWithFont:[UIFont systemFontOfSize:16] byWidth:oneLineMaxW textLineSpacing:5];
  36. if(size.height <= 40){
  37. return 40 + 15;
  38. }else{
  39. return size.height + 15 + 14*2;
  40. }
  41. }
  42. + (ChatMsgDetailChatCell *)configCell0:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  43. static NSString *cellIdentifer = @"ChatMsgDetailChatCell0";
  44. ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  45. if (cell == nil) {
  46. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:0];
  47. }
  48. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  49. cell.backgroundColor = [UIColor clearColor];
  50. cell.contentView.backgroundColor = [UIColor clearColor];
  51. return cell;
  52. }
  53. + (ChatMsgDetailChatCell *)configCell1:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  54. static NSString *cellIdentifer = @"ChatMsgDetailChatCell1";
  55. ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  56. if (cell == nil) {
  57. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:1];
  58. }
  59. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  60. cell.backgroundColor = [UIColor clearColor];
  61. cell.contentView.backgroundColor = [UIColor clearColor];
  62. cell.cell1ContentBgView.width = SCREEN_WIDTH - 66*2;
  63. [cell.cell1ContentBgView setRadius:5 corners:UIRectCornerAllCorners];
  64. return cell;
  65. }
  66. + (ChatMsgDetailChatCell *)configCell2:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  67. static NSString *cellIdentifer = @"ChatMsgDetailChatCell2";
  68. ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  69. if (cell == nil) {
  70. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:2];
  71. }
  72. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  73. cell.backgroundColor = [UIColor clearColor];
  74. cell.contentView.backgroundColor = [UIColor clearColor];
  75. [cell.cell2LeftUserImg setRadius:2 corners:UIRectCornerAllCorners];
  76. // [cell.cell2LeftContentBgView setRadius:5 corners:UIRectCornerAllCorners];
  77. cell.cell2LeftContentBgView.layer.masksToBounds = YES;
  78. cell.cell2LeftContentBgView.layer.cornerRadius = 5;
  79. return cell;
  80. }
  81. + (ChatMsgDetailChatCell *)configCell3:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{
  82. static NSString *cellIdentifer = @"ChatMsgDetailChatCell3";
  83. ChatMsgDetailChatCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];
  84. if (cell == nil) {
  85. cell = [[[NSBundle mainBundle] loadNibNamed:@"ChatMsgDetailChatCell" owner:nil options:nil] objectAtIndex:3];
  86. }
  87. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  88. cell.backgroundColor = [UIColor clearColor];
  89. cell.contentView.backgroundColor = [UIColor clearColor];
  90. [cell.cell3RightUserImg setRadius:2 corners:UIRectCornerAllCorners];
  91. // [cell.cell3RightContentBgView setRadius:5 corners:UIRectCornerAllCorners];
  92. cell.cell3RightContentBgView.layer.masksToBounds = YES;
  93. cell.cell3RightContentBgView.layer.cornerRadius = 5;
  94. return cell;
  95. }
  96. @end