// // LogAddViewController.h // IBOSSmini // // Created by guan hong hou on 2017/5/9. // Copyright © 2017年 elongtian. All rights reserved. // #import "BaseViewController.h" #import "BRDatePickerView.h" #import "DKAudioPlayerHelper.h" #import "DKPhoto.h" #import "UIScrollView+UITouch.h" #import "DateFormat.h" #import "MapViewController.h" #import "LogShareAndCommentInfoModel.h" #import "DKMessage.h" #import "DKMessageTableView.h" #import "DKUITableViewCell.h" #import "DKMessageInputView.h" #import "DKVoiceRecordHUD.h" #import "DKVoiceRecordHelper.h" #import "DKUICollectionViewCellImageProtocol.h" #import "CommentDelegate.h" #import "RefreshDataDelegate.h" #import "LogShareDelegate.h" @protocol DKUITableViewControllerDelegate @optional /** * 发送语音消息的回调方法 * * @param voicePath 目标语音本地路径 * @param voiceDuration 目标语音时长 * @param sender 发送者的名字 * @param date 发送时间 */ - (void)didSendVoice:(NSString *)voicePath voiceDuration:(NSString*)voiceDuration fromSender:(NSString *)sender onDate:(NSDate *)date; /** * 配置TableViewCell高度的方法,如果你想定制自己的Cell样式,那么你必须要实现DataSource中的方法 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id)message; * * @param tableView 目标TableView * @param indexPath 目标IndexPath * @param message 目标消息Model * * @return 返回计算好的Cell高度 */ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id)message; @end @protocol DKUITableViewControllerDataSource @required - (id )messageForRowAtIndexPath:(NSIndexPath *)indexPath; @optional /** * 配置TableViewCell的方法,如果你想定制自己的Cell样式,那么你必须要实现Delegate中的方法 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id)message; * * @param tableView 目标TableView * @param indexPath 目标IndexPath * @param message 目标消息Model * * @return 返回UITableViewCell或者继承于UITableViewCell的实例化对象 */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id)message; @end @interface LogAddViewController :BaseViewController @property(strong, nonatomic) UIButton *btnDate;//日期按钮 @property long preTag;//日期按钮 @property int preMoveY; @property(strong, nonatomic) UIButton *btnShare;//范围权限按钮 @property(strong, nonatomic) UIButton *btnComment; @property (strong, nonatomic) UITextView *txtContent; @property (strong, nonatomic) UILabel *lblPosition; @property(copy, nonatomic) NSString *sShareId;// 分享范围 @property(copy, nonatomic) NSString *sShareUserName;// 分享范围 @property(copy, nonatomic) NSString *sCommentId;//点评人 @property(copy, nonatomic) NSString *sComment;//点评人 @property(copy, nonatomic) NSString *sDate; //日期 @property(copy, nonatomic) NSString *displayDate; //日期 @property(copy, nonatomic) NSString *sLocation; //位置 @property(nonatomic,weak) id refreshDelegate; @property(strong) NSMutableArray *shareArr;//分享范围数组 @property(strong) NSMutableArray *commentArr;//评论数组 @property(strong)BRDatePickerView *brdatePicker;//日期控件 @property (nonatomic, copy) NSString *messageSender;//消息发送者 @property (nonatomic, strong) DKUITableViewCell *currentSelectedCell;//tableviewcell @property (nonatomic , strong) NSMutableArray *assets;//相册数组 @property (nonatomic , strong) NSMutableArray *voicePaths;//声音路径数组 @property (nonatomic , strong) NSMutableArray *voiceUploadPaths;//服务器返回照片的路径 @property (nonatomic , strong) NSMutableArray *voiceUploadTimes;//时间 @property (nonatomic , strong) NSMutableArray *imagePaths;//上传后返回照片的路径 @property (nonatomic , strong) NSMutableArray *imageLocalPaths;//本地存入沙盒照片的路径 @property (retain,nonatomic) UICollectionView *collectionView;//图片collectionview控件 @property (strong,nonatomic) DKCameraViewController *cameraVc;//照相机控制器 @property (nonatomic, assign, readonly) DKInputViewType textViewInputViewType;//底部消息视图类型 @property(strong) ASIDownManager* mDownManager ;//下载管理器 @property(copy, nonatomic) UIImageView *positionImg; //位置图片 @property(copy, nonatomic) UIButton *btnTakePhoto;//拍照按钮 @property(copy, nonatomic) UIButton *btnPhoto;//照片按钮 @property(copy, nonatomic) UIButton *btnPosition;//地图位置按钮 @property(copy, nonatomic) UIView *separatorView;//分隔线 @property(copy, nonatomic) UIImageView *voiceImg;//声音图片控件 @property(copy, nonatomic) UILabel *lblVoice;//语音标签 @property(copy, nonatomic) UIButton *btnRecord;//录音按钮 @property (nonatomic, assign) BOOL allowsPanToDismissKeyboard;//允许键盘消失 @property (nonatomic, assign) BOOL allowsSendVoice;//允许发送语音 @property (nonatomic, strong) NSMutableArray *messages;//消息数组 @property (nonatomic, weak) id dataSource;//DKUITableViewController数据源 @property (nonatomic,strong) DKMessageTableView *messageTV;//消息tableview @property (nonatomic,strong) DKMessageInputView *inputView;//底部语音视图 @property (nonatomic, assign) BOOL isUserScrolling;// 判断是否用户手指滚动 @property (nonatomic, strong, readwrite) DKVoiceRecordHUD *voiceRecordHUD;//声音录制工具类 /** * 管理录音工具对象 */ @property (nonatomic, strong) DKVoiceRecordHelper *voiceRecordHelper; /** * 判断是不是超出了录音最大时长 */ @property (nonatomic) BOOL isMaxTimeStop; #pragma mark - DataSource Change /** * 改变数据源需要的子线程 * * @param queue 子线程执行完成的回调block */ - (void)exChangeMessageDataSourceQueue:(void (^)())queue; /** * 执行块代码在主线程 * * @param queue 主线程执行完成回调block */ - (void)exMainQueue:(void (^)())queue; #pragma mark - RecorderPath Helper Method /** * 获取录音的路径 * * @return 返回录音的路径 */ - (NSString *)getRecorderPath; /** * 根据底部高度获取UIEdgeInsets常量 * * @param bottom 底部高度 * * @return 返回UIEdgeInsets常量 */ - (UIEdgeInsets)tableViewInsetsWithBottomValue:(CGFloat)bottom; #pragma mark - Message Calculate Cell Height /** * 统一计算Cell的高度方法 * * @param message 被计算目标消息对象 * @param indexPath 被计算目标消息所在的位置 * * @return 返回计算的高度 */ - (CGFloat)calculateCellHeightWithMessage:(id )message atIndexPath:(NSIndexPath *)indexPath; #pragma mark - Message Send helper Method /** * 根据录音路径开始发送语音消息 * * @param voicePath 目标语音路径 * @param voiceDuration 目标语音时长 */ - (void)didSendMessageWithVoice:(NSString *)voicePath voiceDuration:(NSString*)voiceDuration; #pragma mark - Voice Recording Helper Method /** * 开始录音 */ - (void)startRecord; /** * 完成录音 */ - (void)finishRecorded; /** * 想停止录音 */ - (void)pauseRecord; /** * 继续录音 */ - (void)resumeRecord; /** * 取消录音 */ - (void)cancelRecord; @end