| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- //
- // UITableViewController.h
- // chatandvideotest
- //
- // Created by Dongke on 15/11/18.
- // Copyright © 2015年 dongke. All rights reserved.
- //
- #import <UIKit/UIKit.h>
- // Model
- #import "DKMessage.h"
- // Views
- #import "DKMessageTableView.h"
- #import "DKUITableViewCell.h"
- #import "DKMessageInputView.h"
- #import "DKVoiceRecordHUD.h"
- #import "DKVoiceRecordHelper.h"
- @protocol DKUITableViewControllerDelegate <NSObject>
- @optional
- - (void)didSendVoice:(NSString *)voicePath voiceDuration:(NSString*)voiceDuration fromSender:(NSString *)sender onDate:(NSDate *)date;
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
- - (void)didCameraAction:(BOOL)flg;
- - (void)didPhotoAction:(BOOL)flg ;
- - (void)didPostionAction:(BOOL)flg ;
- @end
- @protocol DKUITableViewControllerDataSource <NSObject>
- @required
- - (id <DKMessageModel>)messageForRowAtIndexPath:(NSIndexPath *)indexPath;
- @optional
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
- @end
- @interface DKUITableViewController : UIViewController<UITableViewDataSource, UITableViewDelegate, DKUITableViewControllerDelegate, DKUITableViewControllerDataSource, DKUITableViewCellDelegate>
- @property (nonatomic, weak) id <DKUITableViewControllerDelegate> delegate;
- @property (nonatomic, weak) id <DKUITableViewControllerDataSource> dataSource;
- @property (nonatomic, assign, readonly) DKInputViewType textViewInputViewType;
- @property (nonatomic, assign) UIActivityIndicatorViewStyle loadMoreActivityIndicatorViewStyle;
- /**
- * 数据源,显示多少消息
- */
- @property (nonatomic, strong) NSMutableArray *messages;
- /**
- * 消息的主体,默认为nil
- */
- @property (nonatomic, copy) NSString *messageSender;
- /**
- * 用于显示消息的TableView
- */
- @property (nonatomic, weak) DKMessageTableView *messageTableView;
- /**
- * 用于显示发送消息类型控制的工具条,在底部
- */
- @property (nonatomic, weak, readonly) DKMessageInputView *messageInputView;
- #pragma mark - Message View Controller Default stup
- /**
- * 是否允许手势关闭键盘,默认是允许
- */
- @property (nonatomic, assign) BOOL allowsPanToDismissKeyboard; // default is YES
- /**
- * 是否允许发送语音
- */
- @property (nonatomic, assign) BOOL allowsSendVoice; // default is YES
- /**
- * 输入框的样式,默认为扁平化
- */
- @property (nonatomic, assign) DKMessageInputViewStyle inputViewStyle;
- /**
- * 添加一条新的消息
- *
- * @param addedMessage 添加的目标消息对象
- */
- - (void)addMessage:(DKMessage *)addedMessage;
- #pragma mark - Messages view controller
- /**
- * 设置View、tableView的背景颜色
- *
- * @param color 背景颜色
- */
- - (void)setBackgroundColor:(UIColor *)color;
- /**
- * 设置消息列表的背景图片
- *
- * @param backgroundImage 目标背景图片
- */
- - (void)setBackgroundImage:(UIImage *)backgroundImage;
- /**
- * 是否滚动到底部
- *
- * @param animated YES Or NO
- */
- - (void)scrollToBottomAnimated:(BOOL)animated;
- /**
- * 滚动到哪一行
- *
- * @param indexPath 目标行数变量
- * @param position UITableViewScrollPosition 整形常亮
- * @param animated 是否滚动动画,YES or NO
- */
- - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath
- atScrollPosition:(UITableViewScrollPosition)position
- animated:(BOOL)animated;
- #pragma mark - Other Menu View Frame Helper Mehtod
- /**
- * 根据显示或隐藏的需求对所有第三方Menu进行管理
- *
- * @param hide 需求条件
- */
- - (void)layoutOtherMenuViewHiden:(BOOL)hide;
- @end
|