File tree 7 files changed +18
-4
lines changed
7 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 2
2
// ChatAlbumModel.h
3
3
// CocoaAsyncSocket_TCP
4
4
//
5
- // Created by 孟遥遥 on 2017/5/20.
5
+ // Created by 孟遥 on 2017/5/20.
6
6
// Copyright © 2017年 mengyao. All rights reserved.
7
7
//
8
8
26
26
@property (nonatomic , strong ) UIImage *videoCoverImg;
27
27
// 视频时长
28
28
@property (nonatomic , copy ) NSString *videoDuration;
29
+
29
30
@end
Original file line number Diff line number Diff line change 2
2
// ChatAlbumModel.m
3
3
// CocoaAsyncSocket_TCP
4
4
//
5
- // Created by 孟遥遥 on 2017/5/20.
5
+ // Created by 孟遥 on 2017/5/20.
6
6
// Copyright © 2017年 mengyao. All rights reserved.
7
7
//
8
8
9
9
#import " ChatAlbumModel.h"
10
10
11
11
@implementation ChatAlbumModel
12
12
13
+
13
14
@end
Original file line number Diff line number Diff line change 13
13
typedef void (^photoPickerImagesCallback)(NSArray <ChatAlbumModel *> *images);
14
14
15
15
// 返回视频存储的位置
16
- typedef void (^videoPathCallback)(ChatAlbumModel *);
16
+ typedef void (^videoPathCallback)(ChatAlbumModel *videoModel );
17
17
18
18
19
19
@interface UIImage (photoPicker)
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ - (ChatKeyboard *)customKeyboard
38
38
{
39
39
if (!_customKeyboard) {
40
40
_customKeyboard = [[ChatKeyboard alloc ]init];
41
+ // 传入当前控制器 ,方便打开相册(如放到控制器 , 后期的逻辑过多,控制器会更加臃肿)
42
+ _customKeyboard.target = self;
41
43
}
42
44
return _customKeyboard;
43
45
}
Original file line number Diff line number Diff line change 24
24
<string >LaunchScreen </string >
25
25
<key >UIMainStoryboardFile </key >
26
26
<string >Main </string >
27
+ <key >NSPhotoLibraryUsageDescription </key >
28
+ <string >是否允许打开相册 </string >
27
29
<key >UIRequiredDeviceCapabilities </key >
28
30
<array >
29
31
<string >armv7 </string >
Original file line number Diff line number Diff line change 13
13
// 仅声明,消除警告
14
14
- (void )systemKeyboardWillShow : (NSNotification *)note ;
15
15
16
-
16
+ @property ( nonatomic , strong ) UIViewController *target;
17
17
18
18
19
19
Original file line number Diff line number Diff line change 9
9
10
10
#import " ChatKeyboard.h"
11
11
#import " ChatRecordTool.h"
12
+ #import " UIImage+photoPicker.h"
12
13
13
14
@interface ChatHandleButton : UIButton
14
15
@end
@@ -515,6 +516,10 @@ - (void)handleButtonClick:(ChatHandleButton *)button
515
516
switch (button.tag - 9999 ) {
516
517
case 0 :
517
518
{
519
+ // 这里用到了TZImagerPicker 相册选择器 写得挺好的 ,我对它进行了封装和修改了里面一些代码 。 后期有时间会自己写一个相册的选择器
520
+ [UIImage openPhotoPickerGetImages: ^(NSArray <ChatAlbumModel *> *images) {
521
+
522
+ } target: self .target maxCount: 9 ];
518
523
NSLog (@" -------------点击了相册" );
519
524
}
520
525
break ;
@@ -525,6 +530,9 @@ - (void)handleButtonClick:(ChatHandleButton *)button
525
530
break ;
526
531
case 2 :
527
532
{
533
+ [UIImage openPhotoPickerGetVideo: ^(ChatAlbumModel *videoModel) {
534
+
535
+ } target: self .target cacheDirectory: nil ];
528
536
NSLog (@" -------------点击了视频相册" );
529
537
}
530
538
break ;
You can’t perform that action at this time.
0 commit comments