JCHATMessageTableView.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //
  2. // JCHATMessageTableView.m
  3. // JChat
  4. //
  5. // Created by HuminiOS on 15/10/24.
  6. // Copyright © 2015年 HXHG. All rights reserved.
  7. //
  8. #import "JCHATMessageTableView.h"
  9. @implementation JCHATMessageTableView
  10. /*
  11. // Only override drawRect: if you perform custom drawing.
  12. // An empty implementation adversely affects performance during animation.
  13. - (void)drawRect:(CGRect)rect {
  14. // Drawing code
  15. }
  16. */
  17. - (void)setContentSize:(CGSize)contentSize
  18. {
  19. if(_isFlashToLoad){// 去除发消息滚动的影响
  20. if (!CGSizeEqualToSize(self.contentSize, CGSizeZero))
  21. {
  22. if (contentSize.height > self.contentSize.height)
  23. {
  24. CGPoint offset = self.contentOffset;
  25. offset.y += (contentSize.height - self.contentSize.height);
  26. self.contentOffset = offset;
  27. }
  28. }
  29. }
  30. _isFlashToLoad = NO;
  31. [super setContentSize:contentSize];
  32. }
  33. - (void)loadMoreMessage {
  34. _isFlashToLoad = YES;
  35. [self reloadData];
  36. }
  37. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
  38. {
  39. [super touchesBegan:touches withEvent:event];
  40. /* 保证UIMenuController 和 textView同时相应 去掉这里 改为 VC中 tapClick:来处理收回Emoji
  41. if ([self.touchDelegate conformsToProtocol:@protocol(TouchMsgTabDelegate)] &&
  42. [self.touchDelegate respondsToSelector:@selector(msgTableView:touchesBegan:withEvent:)])
  43. {
  44. [self.touchDelegate msgTableView:self touchesBegan:touches withEvent:event];
  45. }
  46. */
  47. }
  48. @end