File tree Expand file tree Collapse file tree 7 files changed +18
-4
lines changed
Expand file tree Collapse file tree 7 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 22// ChatAlbumModel.h
33// CocoaAsyncSocket_TCP
44//
5- // Created by 孟遥遥 on 2017/5/20.
5+ // Created by 孟遥 on 2017/5/20.
66// Copyright © 2017年 mengyao. All rights reserved.
77//
88
2626@property (nonatomic , strong ) UIImage *videoCoverImg;
2727// 视频时长
2828@property (nonatomic , copy ) NSString *videoDuration;
29+
2930@end
Original file line number Diff line number Diff line change 22// ChatAlbumModel.m
33// CocoaAsyncSocket_TCP
44//
5- // Created by 孟遥遥 on 2017/5/20.
5+ // Created by 孟遥 on 2017/5/20.
66// Copyright © 2017年 mengyao. All rights reserved.
77//
88
99#import " ChatAlbumModel.h"
1010
1111@implementation ChatAlbumModel
1212
13+
1314@end
Original file line number Diff line number Diff line change 1313typedef void (^photoPickerImagesCallback)(NSArray <ChatAlbumModel *> *images);
1414
1515// 返回视频存储的位置
16- typedef void (^videoPathCallback)(ChatAlbumModel *);
16+ typedef void (^videoPathCallback)(ChatAlbumModel *videoModel );
1717
1818
1919@interface UIImage (photoPicker)
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ - (ChatKeyboard *)customKeyboard
3838{
3939 if (!_customKeyboard) {
4040 _customKeyboard = [[ChatKeyboard alloc ]init];
41+ // 传入当前控制器 ,方便打开相册(如放到控制器 , 后期的逻辑过多,控制器会更加臃肿)
42+ _customKeyboard.target = self;
4143 }
4244 return _customKeyboard;
4345}
Original file line number Diff line number Diff line change 2424 <string >LaunchScreen </string >
2525 <key >UIMainStoryboardFile </key >
2626 <string >Main </string >
27+ <key >NSPhotoLibraryUsageDescription </key >
28+ <string >是否允许打开相册 </string >
2729 <key >UIRequiredDeviceCapabilities </key >
2830 <array >
2931 <string >armv7 </string >
Original file line number Diff line number Diff line change 1313// 仅声明,消除警告
1414- (void )systemKeyboardWillShow : (NSNotification *)note ;
1515
16-
16+ @property ( nonatomic , strong ) UIViewController *target;
1717
1818
1919
Original file line number Diff line number Diff line change 99
1010#import " ChatKeyboard.h"
1111#import " ChatRecordTool.h"
12+ #import " UIImage+photoPicker.h"
1213
1314@interface ChatHandleButton : UIButton
1415@end
@@ -515,6 +516,10 @@ - (void)handleButtonClick:(ChatHandleButton *)button
515516 switch (button.tag - 9999 ) {
516517 case 0 :
517518 {
519+ // 这里用到了TZImagerPicker 相册选择器 写得挺好的 ,我对它进行了封装和修改了里面一些代码 。 后期有时间会自己写一个相册的选择器
520+ [UIImage openPhotoPickerGetImages: ^(NSArray <ChatAlbumModel *> *images) {
521+
522+ } target: self .target maxCount: 9 ];
518523 NSLog (@" -------------点击了相册" );
519524 }
520525 break ;
@@ -525,6 +530,9 @@ - (void)handleButtonClick:(ChatHandleButton *)button
525530 break ;
526531 case 2 :
527532 {
533+ [UIImage openPhotoPickerGetVideo: ^(ChatAlbumModel *videoModel) {
534+
535+ } target: self .target cacheDirectory: nil ];
528536 NSLog (@" -------------点击了视频相册" );
529537 }
530538 break ;
You can’t perform that action at this time.
0 commit comments