No Description

DXMessageToolBar.h 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /************************************************************
  2. * * EaseMob CONFIDENTIAL
  3. * __________________
  4. * Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
  5. *
  6. * NOTICE: All information contained herein is, and remains
  7. * the property of EaseMob Technologies.
  8. * Dissemination of this information or reproduction of this material
  9. * is strictly forbidden unless prior written permission is obtained
  10. * from EaseMob Technologies.
  11. */
  12. #import <UIKit/UIKit.h>
  13. #import "XHMessageTextView.h"
  14. #import "DXChatBarMoreView.h"
  15. #import "DXFaceView.h"
  16. #import "DXRecordView.h"
  17. #define kInputTextViewMinHeight 36
  18. #define kInputTextViewMaxHeight 200
  19. #define kHorizontalPadding 8
  20. #define kVerticalPadding 5
  21. #define kTouchToRecord @"按住说话"
  22. #define kTouchToFinish @"松开发送"
  23. /**
  24. * 类说明:
  25. * 1、推荐使用[initWithFrame:...]方法进行初始化
  26. * 2、提供默认的录音,表情,更多按钮的附加页面
  27. * 3、可自定义以上的附加页面
  28. */
  29. @class DXChatBarMoreView;
  30. @protocol DXMessageToolBarDelegate;
  31. @interface DXMessageToolBar : UIView
  32. @property (nonatomic, weak) id <DXMessageToolBarDelegate> delegate;
  33. /**
  34. * 操作栏背景图片
  35. */
  36. @property (strong, nonatomic) UIImage *toolbarBackgroundImage;
  37. /**
  38. * 背景图片
  39. */
  40. @property (strong, nonatomic) UIImage *backgroundImage;
  41. /**
  42. * 更多的附加页面
  43. */
  44. //@property (strong, nonatomic) UIView *moreView;
  45. @property (nonatomic, strong) DXChatBarMoreView *moreView;
  46. /**
  47. * 表情的附加页面
  48. */
  49. @property (strong, nonatomic) UIView *faceView;
  50. @property (assign, nonatomic) BOOL enableVoice;
  51. /**
  52. * 录音的附加页面
  53. */
  54. @property (strong, nonatomic) UIView *recordView;
  55. /**
  56. * 用于输入文本消息的输入框
  57. */
  58. @property (strong, nonatomic) XHMessageTextView *inputTextView;
  59. /**
  60. * 文字输入区域最大高度,必须 > KInputTextViewMinHeight(最小高度)并且 < KInputTextViewMaxHeight,否则设置无效
  61. */
  62. @property (nonatomic) CGFloat maxTextInputViewHeight;
  63. /**
  64. * tool bar 底部距离屏幕底部的距离,默认为0
  65. */
  66. @property (nonatomic) CGFloat toolBarOffsetHeight;
  67. /**
  68. * 初始化方法
  69. *
  70. * @param frame 位置及大小
  71. *
  72. * @return DXMessageToolBar
  73. */
  74. - (instancetype)initWithFrame:(CGRect)frame;
  75. /**
  76. * 默认高度
  77. *
  78. * @return 默认高度
  79. */
  80. + (CGFloat)defaultHeight;
  81. /**
  82. * 取消触摸录音键
  83. */
  84. - (void)cancelTouchRecord;
  85. - (void)configKeyboardEvent;
  86. - (void)removeKeyboardEvent;
  87. @end
  88. @protocol DXMessageToolBarDelegate <NSObject>
  89. @optional
  90. /**
  91. * 在普通状态和语音状态之间进行切换时,会触发这个回调函数
  92. *
  93. * @param changedToRecord 是否改为发送语音状态
  94. */
  95. - (void)didStyleChangeToRecord:(BOOL)changedToRecord;
  96. ///**
  97. // * 点击“表情”按钮触发
  98. // *
  99. // * @param isSelected 是否选中。YES,显示表情页面;NO,收起表情页面
  100. // */
  101. - (void)didSelectedFaceButton:(BOOL)isSelected;
  102. //
  103. /**
  104. * 点击“更多”按钮触发
  105. *
  106. * @param isSelected 是否选中。YES,显示更多页面;NO,收起更多页面
  107. */
  108. - (void)didSelectedMoreButton:(BOOL)isSelected;
  109. /**
  110. * 点击“更多-相册”按钮触发
  111. *
  112. * @param
  113. */
  114. - (void)didSelectedMorePhotoButton;
  115. /**
  116. * 点击“更多-相机”按钮触发
  117. *
  118. * @param
  119. */
  120. - (void)didSelectedMoreCameraButton;
  121. /**
  122. * 文字输入框开始编辑
  123. *
  124. * @param inputTextView 输入框对象
  125. */
  126. - (void)inputTextViewDidBeginEditing:(XHMessageTextView *)messageInputTextView;
  127. /**
  128. * 文字输入框将要开始编辑
  129. *
  130. * @param inputTextView 输入框对象
  131. */
  132. - (void)inputTextViewWillBeginEditing:(XHMessageTextView *)messageInputTextView;
  133. /**
  134. * 发送文字消息,可能包含系统自带表情
  135. *
  136. * @param text 文字消息
  137. */
  138. - (void)didSendText:(NSString *)text;
  139. /**
  140. * 发送第三方表情,不会添加到文字输入框中
  141. *
  142. * @param faceLocalPath 选中的表情的本地路径
  143. */
  144. - (void)didSendFace:(NSString *)faceLocalPath;
  145. /**
  146. * 按下录音按钮开始录音
  147. */
  148. - (void)didStartRecordingVoiceAction:(UIView *)recordView;
  149. /**
  150. * 手指向上滑动取消录音
  151. */
  152. - (void)didCancelRecordingVoiceAction:(UIView *)recordView;
  153. /**
  154. * 松开手指完成录音
  155. */
  156. - (void)didFinishRecoingVoiceAction:(UIView *)recordView;
  157. /**
  158. * 当手指离开按钮的范围内时,主要为了通知外部的HUD
  159. */
  160. - (void)didDragOutsideAction:(UIView *)recordView;
  161. /**
  162. * 当手指再次进入按钮的范围内时,主要也是为了通知外部的HUD
  163. */
  164. - (void)didDragInsideAction:(UIView *)recordView;
  165. @required
  166. /**
  167. * 高度变到toHeight
  168. */
  169. - (void)didChangeFrameToHeight:(CGFloat)toHeight;
  170. @end