DKMessageInputView.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. // DKMessageInputView.h
  3. // MessageDisplayExample
  4. //
  5. // Created by 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. typedef NS_ENUM(NSInteger, DKMessageInputViewStyle) {
  10. DKMessageInputViewStyleFlat
  11. };
  12. typedef NS_ENUM(NSUInteger, DKInputViewType) {
  13. DKInputViewTypeNormal = 0,
  14. DKInputViewTypeText,
  15. DKInputViewTypeEmotion,
  16. DKInputViewTypeShareMenu,
  17. };
  18. @protocol DKMessageInputViewDelegate <NSObject>
  19. @optional
  20. /**
  21. * 在发送文本和语音之间发送改变时,会触发这个回调函数
  22. *
  23. * @param changed 是否改为发送语音状态
  24. */
  25. - (void)didChangeSendVoiceAction:(BOOL)changed;
  26. /**
  27. * 发送文本消息,包括系统的表情
  28. *
  29. * @param text 目标文本消息
  30. */
  31. - (void)didSendTextAction:(NSString *)text;
  32. /**
  33. * 点击+号按钮Action
  34. */
  35. - (void)didSelectedMultipleMediaAction;
  36. /**
  37. * 按下錄音按鈕 "準備" 錄音
  38. */
  39. - (void)prepareRecordingVoiceActionWithCompletion:(BOOL (^)(void))completion;
  40. /**
  41. * 开始录音
  42. */
  43. - (void)didStartRecordingVoiceAction;
  44. /**
  45. * 手指向上滑动取消录音
  46. */
  47. - (void)didCancelRecordingVoiceAction;
  48. /**
  49. * 松开手指完成录音
  50. */
  51. - (void)didFinishRecordingVoiceAction;
  52. /**
  53. * 当手指离开按钮的范围内时,主要为了通知外部的HUD
  54. */
  55. - (void)didDragOutsideAction;
  56. /**
  57. * 当手指再次进入按钮的范围内时,主要也是为了通知外部的HUD
  58. */
  59. - (void)didDragInsideAction;
  60. /**
  61. * 发送第三方表情
  62. *
  63. * @param facePath 目标表情的本地路径
  64. */
  65. - (void)didSendFaceAction:(BOOL)sendFace;
  66. -(void)saveLog;
  67. @end
  68. @interface DKMessageInputView : UIImageView
  69. @property (nonatomic, weak) id <DKMessageInputViewDelegate> delegate;
  70. /**
  71. * 当前输入工具条的样式
  72. */
  73. @property (nonatomic, assign) DKMessageInputViewStyle messageInputViewStyle; // default is DKMessageInputViewStyleFlat
  74. /**
  75. * 是否允许发送语音
  76. */
  77. @property (nonatomic, assign) BOOL allowsSendVoice; // default is YES
  78. /**
  79. * 是否允许发送多媒体
  80. */
  81. @property (nonatomic, assign) BOOL allowsSendMultiMedia; // default is YES
  82. /**
  83. * 是否支持发送表情
  84. */
  85. @property (nonatomic, assign) BOOL allowsSendFace; // default is YES
  86. /**
  87. * 是否支持位置
  88. */
  89. @property (nonatomic, assign) BOOL allowsPosition; // default is YES
  90. /**
  91. * 切换文本和语音的按钮
  92. */
  93. @property (nonatomic, weak, readonly) UIButton *voiceChangeButton;
  94. /**
  95. * camera按钮
  96. */
  97. @property (nonatomic, weak, readonly) UIButton *cameraButton;
  98. /**
  99. * photo按钮
  100. */
  101. @property (nonatomic, weak, readonly) UIButton *photoButton;
  102. /**
  103. * 语音录制按钮
  104. */
  105. @property (nonatomic, weak, readonly) UIButton *holdDownButton;
  106. /**
  107. * 键盘按钮
  108. */
  109. @property (nonatomic, weak, readonly) UIButton *keyboardButton;
  110. /**
  111. * 位置按钮
  112. */
  113. @property (nonatomic, weak, readonly) UIButton *positionButton;
  114. // 按钮对象消息
  115. @property (nonatomic, strong)UIButton *saveButton;
  116. @property (nonatomic, strong)UIButton *switchButton;
  117. @property (nonatomic, strong)UIButton *voiceButton;
  118. #pragma mark - Message input view
  119. + (CGFloat)textViewLineHeight;
  120. /**
  121. * 获取最大行数
  122. *
  123. * @return 返回最大行数
  124. */
  125. + (CGFloat)maxLines;
  126. /**
  127. * 获取根据最大行数和每行高度计算出来的最大显示高度
  128. *
  129. * @return 返回最大显示高度
  130. */
  131. + (CGFloat)maDKeight;
  132. @end