JXGifCell.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // JXGifCell.m
  3. // shiku_im
  4. //
  5. // Created by Apple on 16/10/11.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JXGifCell.h"
  9. @implementation JXGifCell
  10. - (void)awakeFromNib {
  11. [super awakeFromNib];
  12. // Initialization code
  13. }
  14. -(void)creatUI{
  15. }
  16. -(void)setCellData{
  17. [super setCellData];
  18. NSString* path = [gifImageFilePath stringByAppendingPathComponent:[self.msg.content lastPathComponent]];
  19. //
  20. if (_gif) {
  21. [_gif removeFromSuperview];
  22. _gif = nil;
  23. // [_gif release];
  24. }
  25. //第三方库,必须有数据才能创建
  26. _gif = [[SCGIFImageView alloc] initWithGIFFile:path];
  27. _gif.userInteractionEnabled = NO;
  28. [self.contentView addSubview:_gif];
  29. // [_gif release];
  30. if(self.msg.isMySend){
  31. NSLog(@"%f %f %f %d",JX_SCREEN_WIDTH, HEAD_SIZE,imageItemHeight, INSETS);
  32. _gif.frame = CGRectMake(CGRectGetMinX(self.headImage.frame)-imageItemHeight-CHAT_WIDTH_ICON+50, 20, imageItemHeight, imageItemHeight);//185
  33. }
  34. else{
  35. _gif.frame = CGRectMake(CGRectGetMaxX(self.headImage.frame) + CHAT_WIDTH_ICON, 20, imageItemHeight, imageItemHeight);
  36. }
  37. if (self.msg.isShowTime) {
  38. CGRect frame = _gif.frame;
  39. frame.origin.y = _gif.frame.origin.y + 40;
  40. _gif.frame = frame;
  41. }
  42. self.bubbleBg.frame=_gif.frame;
  43. }
  44. + (float)getChatCellHeight:(JXMessageObject *)msg {
  45. if ([msg.chatMsgHeight floatValue] > 1) {
  46. return [msg.chatMsgHeight floatValue];
  47. }
  48. float n = 0;
  49. if (msg.isGroup && !msg.isMySend) {
  50. if (msg.isShowTime) {
  51. n = imageItemHeight+20*2 + 40;
  52. }else {
  53. n = imageItemHeight+20*2;
  54. }
  55. n += GROUP_CHAT_INSET;
  56. }else {
  57. if (msg.isShowTime) {
  58. n = imageItemHeight+10*2 + 40;
  59. }else {
  60. n = imageItemHeight+10*2;
  61. }
  62. }
  63. msg.chatMsgHeight = [NSString stringWithFormat:@"%f",n];
  64. if (!msg.isNotUpdateHeight) {
  65. [msg updateChatMsgHeight];
  66. }
  67. return n;
  68. }
  69. -(void)didTouch:(UIButton*)button{
  70. }
  71. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  72. [super setSelected:selected animated:animated];
  73. // Configure the view for the selected state
  74. }
  75. @end