DKMessageBubbleView.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. //
  2. // DKMessageBubbleView.h
  3. // MessageDisplayExample
  4. //
  5. // Created by HUAJIE-1 on 14-4-24.
  6. // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. // Views
  10. //#import "DKMessageTextView.h"
  11. #import "DKMessageInputView.h"
  12. //#import "DKBubblePhotoImageView.h"
  13. //#import "SETextView.h"
  14. #import "DKAnimatedImageView.h"
  15. //#import "DKAnimatedImage.h"
  16. // Macro
  17. #import "DKMacro.h"
  18. // Model
  19. #import "DKMessage.h"
  20. // Factorys
  21. //#import "DKMessageAvatarFactory.h"
  22. #import "DKMessageVoiceFactory.h"
  23. #define kDKMessageBubbleDisplayMaxLine 200
  24. #define kDKTextLineSpacing 3.0
  25. @interface DKMessageBubbleView : UIView
  26. /**
  27. * 目标消息Model对象
  28. */
  29. @property (nonatomic, strong, readonly) id <DKMessageModel> message;
  30. /**
  31. * 自定义显示文本消息控件,子类化的原因有两个,第一个是屏蔽Menu的显示。第二是传递手势到下一层,因为文本需要双击的手势
  32. */
  33. //@property (nonatomic, weak, readonly) SETextView *displayTextView;
  34. /**
  35. * 用于显示气泡的ImageView控件
  36. */
  37. @property (nonatomic, weak, readonly) UIImageView *bubbleImageView;
  38. /**
  39. * 专门用于gif表情显示控件
  40. */
  41. //@property (nonatomic, weak, readonly) FLAnimatedImageView *emotionImageView;
  42. /**
  43. * 用于显示语音的控件,并且支持播放动画
  44. */
  45. @property (nonatomic, weak, readonly) UIImageView *animationVoiceImageView;
  46. /**
  47. * 用于显示语音未读的控件,小圆点
  48. */
  49. @property (nonatomic, weak, readonly) UIImageView *voiceUnreadDotImageView;
  50. /**
  51. * 用于显示语音时长的label
  52. */
  53. @property (nonatomic, weak, readonly) UILabel *voiceDurationLabel;
  54. ///**
  55. // * 用于显示仿微信发送图片的控件
  56. // */
  57. //@property (nonatomic, weak, readonly) DKBubblePhotoImageView *bubblePhotoImageView;
  58. /**
  59. * 显示语音播放的图片控件
  60. */
  61. @property (nonatomic, weak, readonly) UIImageView *videoPlayImageView;
  62. /**
  63. * 显示地理位置的文本控件
  64. */
  65. //@property (nonatomic, weak, readonly) UILabel *geolocationsLabel;
  66. /**
  67. * 设置文本消息的字体
  68. */
  69. @property (nonatomic, strong) UIFont *font UI_APPEARANCE_SELECTOR;
  70. /**
  71. * 初始化消息内容显示控件的方法
  72. *
  73. * @param frame 目标Frame
  74. * @param message 目标消息Model对象
  75. *
  76. * @return 返回DKMessageBubbleView类型的对象
  77. */
  78. - (instancetype)initWithFrame:(CGRect)frame
  79. message:(id <DKMessageModel>)message;
  80. /**
  81. * 获取气泡相对于父试图的位置
  82. *
  83. * @return 返回气泡的位置
  84. */
  85. - (CGRect)bubbleFrame;
  86. /**
  87. * 根据消息Model对象配置消息显示内容
  88. *
  89. * @param message 目标消息Model对象
  90. */
  91. - (void)configureCellWithMessage:(id <DKMessageModel>)message;
  92. /**
  93. * 根据消息Model对象计算消息内容的高度
  94. *
  95. * @param message 目标消息Model对象
  96. *
  97. * @return 返回所需高度
  98. */
  99. + (CGFloat)calculateCellHeightWithMessage:(id <DKMessageModel>)message;
  100. @end