Commit f7cbe085b85a7febad5700fe6615e5bf8eecd35b

Authored by 梁星国
1 parent c4bc1fd2

提交更改了依赖库,但是音视频通话,音频没有依赖

CNLiveImagePickerController.podspec
@@ -18,7 +18,7 @@ Pod::Spec.new do |s| @@ -18,7 +18,7 @@ Pod::Spec.new do |s|
18 # * Finally, don't worry about the indent, CocoaPods strips it! 18 # * Finally, don't worry about the indent, CocoaPods strips it!
19 19
20 s.description = <<-DESC 20 s.description = <<-DESC
21 -TODO: Add long description of the pod here. 21 +在TZImagePickerController基础上更改加入也无需求和Icould加载识别部分
22 DESC 22 DESC
23 23
24 s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveImagePickerController' 24 s.homepage = 'http://bj.gitlab.cnlive.com/ios-team/CNLiveImagePickerController'
@@ -42,7 +42,13 @@ TODO: Add long description of the pod here. @@ -42,7 +42,13 @@ TODO: Add long description of the pod here.
42 # s.public_header_files = 'Pod/Classes/**/*.h' 42 # s.public_header_files = 'Pod/Classes/**/*.h'
43 # s.frameworks = 'UIKit', 'MapKit' 43 # s.frameworks = 'UIKit', 'MapKit'
44 # s.dependency 'CNLiveBaseKit' 44 # s.dependency 'CNLiveBaseKit'
45 - # s.dependency 'CNLiveUploadManager' 45 + # s.dependency 'CNLiveUploadManager'
  46 +
  47 + s.dependency 'CNLiveTripartiteManagement/SDAutoLayout'
  48 + s.dependency 'CNLiveTripartiteManagement/QMUIKit'
  49 + s.dependency 'CNLiveBaseKit'
  50 + s.dependency 'CNLiveUploadManager'
  51 + s.dependency 'CNLiveBusinessTools'
46 52
47 53
48 54
CNLiveImagePickerController/Classes/CNEditVideoController.m
@@ -14,6 +14,8 @@ @@ -14,6 +14,8 @@
14 #import "TZImagePickerController.h" 14 #import "TZImagePickerController.h"
15 #import "TZPhotoPreviewCell.h" 15 #import "TZPhotoPreviewCell.h"
16 #import "TZImageCropManager.h" 16 #import "TZImageCropManager.h"
  17 +#import <SDAutoLayout/SDAutoLayout.h>
  18 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
17 19
18 #define kItemWidth kItemHeight * 2/3 20 #define kItemWidth kItemHeight * 2/3
19 #define kItemHeight 50 21 #define kItemHeight 50
@@ -120,59 +122,58 @@ @@ -120,59 +122,58 @@
120 CGPoint point = [pan locationInView:self]; 122 CGPoint point = [pan locationInView:self];
121 123
122 CGRect rct = self.validRect; 124 CGRect rct = self.validRect;
123 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
124 -// const CGFloat W = self.width;  
125 -// CGFloat minX = 0;  
126 -// CGFloat maxX = W;  
127 -//  
128 -// switch (pan.view.tag) {  
129 -// case 0: {  
130 -// //left视图响应  
131 -// maxX = rct.origin.x + rct.size.width - kItemWidth;  
132 -//  
133 -// point.x = MAX(minX, MIN(point.x, maxX));  
134 -// point.y = 0;  
135 -//  
136 -// rct.size.width -= (point.x - rct.origin.x);  
137 -// rct.origin.x = point.x;  
138 -// }  
139 -// break;  
140 -//  
141 -// case 1:  
142 -// {  
143 -// //right视图响应  
144 -// minX = rct.origin.x + kItemWidth/2;  
145 -// maxX = W - kItemWidth/2;  
146 -//  
147 -// point.x = MAX(minX, MIN(point.x, maxX));  
148 -// point.y = 0;  
149 -//  
150 -// rct.size.width = (point.x - rct.origin.x + kItemWidth/2);  
151 -// }  
152 -// break;  
153 -// }  
154 -//  
155 -// switch (pan.state) {  
156 -// case UIGestureRecognizerStateBegan:  
157 -// case UIGestureRecognizerStateChanged:  
158 -// if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectChanged)]) {  
159 -// [self.delegate editViewValidRectChanged];//滑动响应实现  
160 -// }  
161 -// break;  
162 -//  
163 -// case UIGestureRecognizerStateEnded:  
164 -// case UIGestureRecognizerStateCancelled:  
165 -// self.layer.borderColor = [UIColor clearColor].CGColor;  
166 -// if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectEndChanged)]) {  
167 -// [self.delegate editViewValidRectEndChanged];//滑动结束响应实现  
168 -// }  
169 -// break;  
170 -//  
171 -// default:  
172 -// break;  
173 -// }  
174 -//  
175 - ////////////////////////////// 125 + const CGFloat W = self.width;
  126 + CGFloat minX = 0;
  127 + CGFloat maxX = W;
  128 +
  129 + switch (pan.view.tag) {
  130 + case 0: {
  131 + //left视图响应
  132 + maxX = rct.origin.x + rct.size.width - kItemWidth;
  133 +
  134 + point.x = MAX(minX, MIN(point.x, maxX));
  135 + point.y = 0;
  136 +
  137 + rct.size.width -= (point.x - rct.origin.x);
  138 + rct.origin.x = point.x;
  139 + }
  140 + break;
  141 +
  142 + case 1:
  143 + {
  144 + //right视图响应
  145 + minX = rct.origin.x + kItemWidth/2;
  146 + maxX = W - kItemWidth/2;
  147 +
  148 + point.x = MAX(minX, MIN(point.x, maxX));
  149 + point.y = 0;
  150 +
  151 + rct.size.width = (point.x - rct.origin.x + kItemWidth/2);
  152 + }
  153 + break;
  154 + }
  155 +
  156 + switch (pan.state) {
  157 + case UIGestureRecognizerStateBegan:
  158 + case UIGestureRecognizerStateChanged:
  159 + if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectChanged)]) {
  160 + [self.delegate editViewValidRectChanged];//滑动响应实现
  161 + }
  162 + break;
  163 +
  164 + case UIGestureRecognizerStateEnded:
  165 + case UIGestureRecognizerStateCancelled:
  166 + self.layer.borderColor = [UIColor clearColor].CGColor;
  167 + if (self.delegate && [self.delegate respondsToSelector:@selector(editViewValidRectEndChanged)]) {
  168 + [self.delegate editViewValidRectEndChanged];//滑动结束响应实现
  169 + }
  170 + break;
  171 +
  172 + default:
  173 + break;
  174 + }
  175 +
  176 +
176 177
177 self.validRect = rct; 178 self.validRect = rct;
178 } 179 }
@@ -299,30 +300,30 @@ @@ -299,30 +300,30 @@
299 - (void)viewDidLayoutSubviews 300 - (void)viewDidLayoutSubviews
300 { 301 {
301 [super viewDidLayoutSubviews]; 302 [super viewDidLayoutSubviews];
302 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
303 -// UIEdgeInsets inset = UIEdgeInsetsZero;  
304 -// if (@available(iOS 11, *)) {  
305 -// inset = self.view.safeAreaInsets;  
306 -// }  
307 -//  
308 -// self.playerLayer.frame = CGRectMake(15, inset.top>0?inset.top:30, KScreenWidth-30, KScreenHeight-160-inset.bottom);  
309 -//  
310 -// self.editView.frame = CGRectMake((KScreenWidth-kItemWidth*10)/2, KScreenHeight-100-inset.bottom, kItemWidth*10, kItemHeight);  
311 -// self.editView.validRect = self.editView.bounds;  
312 -// self.collectionView.frame = CGRectMake(inset.left, KScreenHeight-100-inset.bottom, KScreenWidth-inset.left-inset.right, kItemHeight);  
313 -//  
314 -// CGFloat leftOffset = ((KScreenWidth-kItemWidth*10)/2-inset.left);  
315 -// CGFloat rightOffset = ((KScreenWidth-kItemWidth*10)/2-inset.right);  
316 -// [self.collectionView setContentInset:UIEdgeInsetsMake(0, leftOffset, 0, rightOffset)];  
317 -// [self.collectionView setContentOffset:CGPointMake(_offsetX-leftOffset, 0)];  
318 -//  
319 -// CGFloat bottomViewH = 44;  
320 -// CGFloat bottomBtnH = 30;  
321 -// _bottomView.frame = CGRectMake(0, KScreenHeight-bottomViewH-inset.bottom, KScreenWidth, kItemHeight);  
322 -// _cancelBtn.frame = CGRectMake(10+inset.left, 7, 60, bottomBtnH);  
323 -// _doneBtn.frame = CGRectMake(KScreenWidth-70-inset.right, 7, 60, bottomBtnH);  
324 -//  
325 - /////////////////////////////////////// 303 +
  304 + UIEdgeInsets inset = UIEdgeInsetsZero;
  305 + if (@available(iOS 11, *)) {
  306 + inset = self.view.safeAreaInsets;
  307 + }
  308 +
  309 + self.playerLayer.frame = CGRectMake(15, inset.top>0?inset.top:30, KScreenWidth-30, KScreenHeight-160-inset.bottom);
  310 +
  311 + self.editView.frame = CGRectMake((KScreenWidth-kItemWidth*10)/2, KScreenHeight-100-inset.bottom, kItemWidth*10, kItemHeight);
  312 + self.editView.validRect = self.editView.bounds;
  313 + self.collectionView.frame = CGRectMake(inset.left, KScreenHeight-100-inset.bottom, KScreenWidth-inset.left-inset.right, kItemHeight);
  314 +
  315 + CGFloat leftOffset = ((KScreenWidth-kItemWidth*10)/2-inset.left);
  316 + CGFloat rightOffset = ((KScreenWidth-kItemWidth*10)/2-inset.right);
  317 + [self.collectionView setContentInset:UIEdgeInsetsMake(0, leftOffset, 0, rightOffset)];
  318 + [self.collectionView setContentOffset:CGPointMake(_offsetX-leftOffset, 0)];
  319 +
  320 + CGFloat bottomViewH = 44;
  321 + CGFloat bottomBtnH = 30;
  322 + _bottomView.frame = CGRectMake(0, KScreenHeight-bottomViewH-inset.bottom, KScreenWidth, kItemHeight);
  323 + _cancelBtn.frame = CGRectMake(10+inset.left, 7, 60, bottomBtnH);
  324 + _doneBtn.frame = CGRectMake(KScreenWidth-70-inset.right, 7, 60, bottomBtnH);
  325 +
  326 +
326 [self.playerLayer setBackgroundColor:[UIColor clearColor].CGColor]; 327 [self.playerLayer setBackgroundColor:[UIColor clearColor].CGColor];
327 } 328 }
328 329
@@ -379,9 +380,9 @@ @@ -379,9 +380,9 @@
379 [self.view addSubview:self.editView]; 380 [self.view addSubview:self.editView];
380 381
381 _indicatorLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 2, kItemHeight)]; 382 _indicatorLine = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 2, kItemHeight)];
382 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
383 -// _indicatorLine.backgroundColor = [RGBOF(0x0BBE06) colorWithAlphaComponent:.7];  
384 - ///////////////// 383 +
  384 + _indicatorLine.backgroundColor = [RGBOF(0x0BBE06) colorWithAlphaComponent:.7];
  385 +
385 } 386 }
386 387
387 - (void)creatBottomView 388 - (void)creatBottomView
@@ -397,14 +398,13 @@ @@ -397,14 +398,13 @@
397 [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal]; 398 [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
398 [_cancelBtn addTarget:self action:@selector(cancelBtn_click) forControlEvents:UIControlEventTouchUpInside]; 399 [_cancelBtn addTarget:self action:@selector(cancelBtn_click) forControlEvents:UIControlEventTouchUpInside];
399 [_bottomView addSubview:_cancelBtn]; 400 [_bottomView addSubview:_cancelBtn];
400 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
401 -// _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom];  
402 -// [_doneBtn setTitle:@"完成" forState:UIControlStateNormal];  
403 -// [_doneBtn setBackgroundColor:[UIColor clearColor]];  
404 -//  
405 -// [_doneBtn setTitleColor:RGBOF(0x0BBE06) forState:UIControlStateNormal];  
406 -// _doneBtn.titleLabel.font = [UIFont systemFontOfSize:15];  
407 - //////////////////////// 401 +
  402 + _doneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  403 + [_doneBtn setTitle:@"完成" forState:UIControlStateNormal];
  404 + [_doneBtn setBackgroundColor:[UIColor clearColor]];
  405 +
  406 + [_doneBtn setTitleColor:RGBOF(0x0BBE06) forState:UIControlStateNormal];
  407 + _doneBtn.titleLabel.font = [UIFont systemFontOfSize:15];
408 _doneBtn.layer.masksToBounds = YES; 408 _doneBtn.layer.masksToBounds = YES;
409 _doneBtn.layer.cornerRadius = 3.0f; 409 _doneBtn.layer.cornerRadius = 3.0f;
410 [_doneBtn addTarget:self action:@selector(btnDone_click) forControlEvents:UIControlEventTouchUpInside]; 410 [_doneBtn addTarget:self action:@selector(btnDone_click) forControlEvents:UIControlEventTouchUpInside];
CNLiveImagePickerController/Classes/CNImagePickerController.m
@@ -7,6 +7,8 @@ @@ -7,6 +7,8 @@
7 // 7 //
8 8
9 #import "CNImagePickerController.h" 9 #import "CNImagePickerController.h"
  10 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  11 +#import <QMUIKit/QMUIKit.h>
10 12
11 @interface CNImagePickerController () 13 @interface CNImagePickerController ()
12 14
@@ -44,256 +46,256 @@ @@ -44,256 +46,256 @@
44 // imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor]; 46 // imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
45 // imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor]; 47 // imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
46 // imagePickerVc.navigationBar.translucent = NO; 48 // imagePickerVc.navigationBar.translucent = NO;
47 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
48 -// self.iconThemeColor = RGBOF(0x00BBE06);// 主体颜色  
49 -// self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层  
50 -// self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层  
51 -// self.photoDefImage = [UIImage imageNamed:@"photo_cell_normal"];  
52 -// self.photoSelImage = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(22, 22) cornerRadius:11];  
53 -// self.photoOriginDefImage = [UIImage imageNamed:@"photo_original_nor"];  
54 -//  
55 -// // 3. Set allow picking video & photo & originalPhoto or not  
56 -// // 3. 设置是否可以选择视频/图片/原图/gif(未开放)  
57 -// self.allowPickingVideo = YES;// 显示视频  
58 -// self.allowPickingImage = YES;// 显示图片  
59 -// self.allowPickingOriginalPhoto = YES; //显示原图  
60 -// self.allowPickingGif = NO;// 显示GIF  
61 -// self.allowPickingMultipleVideo = YES; // 是否可以多选视频  
62 -//  
63 -// // 4. 照片排列按修改时间升序  
64 -// self.sortAscendingByModificationDate = YES;  
65 -//  
66 -// // imagePickerVc.minImagesCount = 3;  
67 -// // imagePickerVc.alwaysEnableDoneBtn = YES;  
68 -//  
69 -// // imagePickerVc.minPhotoWidthSelectable = 3000;  
70 -// // imagePickerVc.minPhotoHeightSelectable = 2000;  
71 -//  
72 -// /// 5. Single selection mode, valid when maxImagesCount = 1  
73 -// /// 5. 单选模式,maxImagesCount为1时才生效  
74 -// self.showSelectBtn = NO;  
75 -// self.allowCrop = NO;  
76 -// self.needCircleCrop = NO;  
77 -// // 设置横屏下的裁剪尺寸  
78 -// // imagePickerVc.cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, left, widthHeight, widthHeight);  
79 -// /*  
80 -// [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) {  
81 -// cropView.layer.borderColor = [UIColor redColor].CGColor;  
82 -// cropView.layer.borderWidth = 2.0;  
83 -// }];*/  
84 -//  
85 -// //imagePickerVc.allowPreview = NO;  
86 -// // 自定义导航栏上的返回按钮  
87 -// /*  
88 -// [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){  
89 -// [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];  
90 -// [leftButton setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 20)];  
91 -// }];  
92 -// imagePickerVc.delegate = self;  
93 -// */  
94 -//  
95 -// self.statusBarStyle = UIStatusBarStyleDefault;//状态栏黑色  
96 -//  
97 -// self.showSelectedIndex = YES; // 设置是否显示图片序号  
98 -//  
99 -// self.naviBgColor = RGBOF(0xFFFFFF);//导航栏颜色  
100 -// self.naviTitleColor = RGBOF(0x282828);//相册title  
101 -// self.naviTitleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:18];//title文字大小  
102 -// [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标  
103 -// [leftButton setImage:[UIImage imageNamed:@"photo_back"] forState:UIControlStateNormal];//返回按钮图片  
104 -// [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小  
105 -// [leftButton setTitleColor:RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色  
106 -// leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小  
107 -// leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘  
108 -// }];  
109 -// self.barItemTextColor = RGBOF(0x282828);//设置barItem文字颜色  
110 -// self.barItemTextFont = [UIFont systemFontOfSize:15];  
111 -//  
112 -// // 设置首选语言 / Set preferred language  
113 -// // imagePickerVc.preferredLanguage = @"zh-Hans";  
114 -//  
115 -// // 设置languageBundle以使用其它语言 / Set languageBundle to use other language  
116 -// // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]];  
117 -//  
118 -// /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等  
119 -// //相册  
120 -// [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {  
121 -//  
122 -// //底部栏  
123 -// [bottomToolBar setBackgroundColor:RGBOF(0xFFFFFF)];  
124 -//  
125 -// //预览  
126 -// previewButton.titleLabel.font = [UIFont systemFontOfSize:16];  
127 -// [previewButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用  
128 -// [previewButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];//默认  
129 -//  
130 -// //原图按钮  
131 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用  
132 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认  
133 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中  
134 -// originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];  
135 -// [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];  
136 -// [originalPhotoButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];  
137 -//  
138 -// //原图文字提示  
139 -// originalPhotoLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:16];  
140 -// originalPhotoLabel.textColor = RGBOF(0xB3B3B3);  
141 -// originalPhotoLabel.hidden = YES;  
142 -//  
143 -// //选中提示  
144 -// numberImageView = [UIImageView new];  
145 -// numberLabel = [UILabel new];  
146 -//  
147 -// //完成按钮  
148 -// doneButton.titleLabel.font = [UIFont systemFontOfSize:13];  
149 -// [doneButton setTitle:@"完成" forState:UIControlStateDisabled];  
150 -// [doneButton setTitleColor:RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled];  
151 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];  
152 -//  
153 -// //颜色绘制成图片  
154 -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];  
155 -// [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled];  
156 -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];  
157 -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];  
158 -// doneButton.layer.masksToBounds = YES;  
159 -// doneButton.layer.cornerRadius = 5;  
160 -//  
161 -// //分割线  
162 -// [divideLine setBackgroundColor:RGBOF(0xDEDEDE)];  
163 -//  
164 -// }]; 49 +
  50 + self.iconThemeColor = RGBOF(0x00BBE06);// 主体颜色
  51 + self.showPhotoCannotSelectLayer = YES;//达到上限是否有浮层
  52 + self.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];//设置达到上限的浮层
  53 + self.photoDefImage = [UIImage imageNamed:@"photo_cell_normal"];
  54 + self.photoSelImage = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(22, 22) cornerRadius:11];
  55 + self.photoOriginDefImage = [UIImage imageNamed:@"photo_original_nor"];
  56 +
  57 + // 3. Set allow picking video & photo & originalPhoto or not
  58 + // 3. 设置是否可以选择视频/图片/原图/gif(未开放)
  59 + self.allowPickingVideo = YES;// 显示视频
  60 + self.allowPickingImage = YES;// 显示图片
  61 + self.allowPickingOriginalPhoto = YES; //显示原图
  62 + self.allowPickingGif = NO;// 显示GIF
  63 + self.allowPickingMultipleVideo = YES; // 是否可以多选视频
  64 +
  65 + // 4. 照片排列按修改时间升序
  66 + self.sortAscendingByModificationDate = YES;
  67 +
  68 + // imagePickerVc.minImagesCount = 3;
  69 + // imagePickerVc.alwaysEnableDoneBtn = YES;
  70 +
  71 + // imagePickerVc.minPhotoWidthSelectable = 3000;
  72 + // imagePickerVc.minPhotoHeightSelectable = 2000;
  73 +
  74 + /// 5. Single selection mode, valid when maxImagesCount = 1
  75 + /// 5. 单选模式,maxImagesCount为1时才生效
  76 + self.showSelectBtn = NO;
  77 + self.allowCrop = NO;
  78 + self.needCircleCrop = NO;
  79 + // 设置横屏下的裁剪尺寸
  80 + // imagePickerVc.cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, left, widthHeight, widthHeight);
  81 + /*
  82 + [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) {
  83 + cropView.layer.borderColor = [UIColor redColor].CGColor;
  84 + cropView.layer.borderWidth = 2.0;
  85 + }];*/
  86 +
  87 + //imagePickerVc.allowPreview = NO;
  88 + // 自定义导航栏上的返回按钮
  89 + /*
  90 + [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){
  91 + [leftButton setImage:[UIImage imageNamed:@"back"] forState:UIControlStateNormal];
  92 + [leftButton setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 20)];
  93 + }];
  94 + imagePickerVc.delegate = self;
  95 + */
  96 +
  97 + self.statusBarStyle = UIStatusBarStyleDefault;//状态栏黑色
  98 +
  99 + self.showSelectedIndex = YES; // 设置是否显示图片序号
  100 +
  101 + self.naviBgColor = RGBOF(0xFFFFFF);//导航栏颜色
  102 + self.naviTitleColor = RGBOF(0x282828);//相册title
  103 + self.naviTitleFont = [UIFont fontWithName:@"PingFangSC-Medium" size:18];//title文字大小
  104 + [self setNavLeftBarButtonSettingBlock:^(UIButton *leftButton) {//设置返回按钮图标
  105 + [leftButton setImage:[UIImage imageNamed:@"photo_back"] forState:UIControlStateNormal];//返回按钮图片
  106 + [leftButton setTitle:@"返回" forState:UIControlStateNormal];//设置文字大小
  107 + [leftButton setTitleColor:RGBOF(0x282828) forState:UIControlStateNormal];//设置文字颜色
  108 + leftButton.titleLabel.font = [UIFont systemFontOfSize:15];//设置文字大小
  109 + leftButton.imageEdgeInsets = UIEdgeInsetsMake(0, -7, 0, +7);//设置图片边缘
  110 + }];
  111 + self.barItemTextColor = RGBOF(0x282828);//设置barItem文字颜色
  112 + self.barItemTextFont = [UIFont systemFontOfSize:15];
  113 +
  114 + // 设置首选语言 / Set preferred language
  115 + // imagePickerVc.preferredLanguage = @"zh-Hans";
  116 +
  117 + // 设置languageBundle以使用其它语言 / Set languageBundle to use other language
  118 + // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]];
  119 +
  120 + /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等
  121 + //相册
  122 + [self setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {
  123 +
  124 + //底部栏
  125 + [bottomToolBar setBackgroundColor:RGBOF(0xFFFFFF)];
  126 +
  127 + //预览
  128 + previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
  129 + [previewButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];//禁用
  130 + [previewButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];//默认
  131 +
  132 + //原图按钮
  133 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用
  134 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认
  135 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中
  136 + originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];
  137 + [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];
  138 + [originalPhotoButton setTitleColor:RGBOF(0x000000) forState:UIControlStateNormal];
  139 +
  140 + //原图文字提示
  141 + originalPhotoLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:16];
  142 + originalPhotoLabel.textColor = RGBOF(0xB3B3B3);
  143 + originalPhotoLabel.hidden = YES;
  144 +
  145 + //选中提示
  146 + numberImageView = [UIImageView new];
  147 + numberLabel = [UILabel new];
  148 +
  149 + //完成按钮
  150 + doneButton.titleLabel.font = [UIFont systemFontOfSize:13];
  151 + [doneButton setTitle:@"完成" forState:UIControlStateDisabled];
  152 + [doneButton setTitleColor:RGBAOF(0xFFFFFF, 0.5) forState:UIControlStateDisabled];
  153 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];
  154 +
  155 + //颜色绘制成图片
  156 + UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];
  157 + [doneButton setBackgroundImage:dis_image forState:UIControlStateDisabled];
  158 + UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];
  159 + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];
  160 + doneButton.layer.masksToBounds = YES;
  161 + doneButton.layer.cornerRadius = 5;
  162 +
  163 + //分割线
  164 + [divideLine setBackgroundColor:RGBOF(0xDEDEDE)];
  165 +
  166 + }];
165 167
166 -// //图片预览  
167 -// [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) {  
168 -//  
169 -// //返回按钮  
170 -// [backButton setImage:[UIImage imageNamed:@"photo_original_back"] forState:UIControlStateNormal];  
171 -// //选择按钮  
172 -// [selectButton setImage:[UIImage imageNamed:@"photo_original_nor"] forState:UIControlStateNormal];  
173 -// [selectButton setImage:[UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(28, 28) cornerRadius:14] forState:UIControlStateSelected];  
174 -// [selectButton setTitle:@"" forState:UIControlStateDisabled];  
175 -//  
176 -// //原图按钮  
177 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用  
178 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认  
179 -// [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中  
180 -// originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];  
181 -// [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];  
182 -// [originalPhotoButton setTitleColor:RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal];  
183 -// //原图内容隐藏  
184 -// originalPhotoLabel.hidden = YES;  
185 -//  
186 -// //完成按钮  
187 -// doneButton.titleLabel.font = [UIFont systemFontOfSize:13];  
188 -// [doneButton setTitle:@"完成" forState:UIControlStateDisabled];  
189 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];  
190 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];  
191 -//  
192 -// //颜色绘制成图片  
193 -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];  
194 -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];  
195 -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];  
196 -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];  
197 -// doneButton.layer.masksToBounds = YES;  
198 -// doneButton.layer.cornerRadius = 5;  
199 -// }];  
200 -//  
201 -// //视频预览  
202 -// [self setVideoPreviewPageUIConfigBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) {  
203 -//  
204 -// //完成按钮  
205 -// doneButton.titleLabel.font = [UIFont systemFontOfSize:13];  
206 -// [doneButton setTitle:@"完成" forState:UIControlStateDisabled];  
207 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];  
208 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];  
209 -//  
210 -// //颜色绘制成图片  
211 -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];  
212 -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];  
213 -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];  
214 -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];  
215 -// doneButton.layer.masksToBounds = YES;  
216 -// doneButton.layer.cornerRadius = 5;  
217 -//  
218 -// }];  
219 -//  
220 -// //gif预览  
221 -// [self setGifPreviewPageUIConfigBlock:^(UIView *toolBar, UIButton *doneButton) {  
222 -//  
223 -// //完成按钮  
224 -// doneButton.titleLabel.font = [UIFont systemFontOfSize:13];  
225 -// [doneButton setTitle:@"完成" forState:UIControlStateDisabled];  
226 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];  
227 -// [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];  
228 -//  
229 -// //颜色绘制成图片  
230 -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];  
231 -// [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];  
232 -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];  
233 -// [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];  
234 -// doneButton.layer.masksToBounds = YES;  
235 -// doneButton.layer.cornerRadius = 5;  
236 -//  
237 -// }];  
238 -// //相册cell  
239 -// [self setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {  
240 -//  
241 -//  
242 -// }];  
243 -// //相簿  
244 -// [self setAlbumCellDidSetModelBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {  
245 -// [posterImageView setBackgroundColor:[UIColor blueColor]];  
246 -// [posterImageView setBackgroundColor:[UIColor blueColor]];  
247 -//  
248 -// }];  
249 -//  
250 -//  
251 -// /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等  
252 -// //相册  
253 -// [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {  
254 -//  
255 -// CGRect frame = bottomToolBar.frame;  
256 -// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);  
257 -//  
258 -// CGRect originalPhotoLabelFrame = originalPhotoLabel.frame;  
259 -// CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2;  
260 -// CGFloat originalY = originalPhotoLabelFrame.origin.y;  
261 -// originalPhotoButton.frame = CGRectMake(originalX, originalY, originalPhotoLabelFrame.size.width, originalPhotoLabelFrame.size.height);  
262 -//  
263 -//  
264 -// }];  
265 -// //图片预览  
266 -// [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) {  
267 -//  
268 -// CGRect frame = toolBar.frame;  
269 -// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);  
270 -//  
271 -// }];  
272 -// //视频预览  
273 -// [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) {  
274 -//  
275 -// CGRect frame = toolBar.frame;  
276 -// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);  
277 -//  
278 -// }];  
279 -// //gif预览  
280 -// [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) {  
281 -//  
282 -// CGRect frame = toolBar.frame;  
283 -// doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);  
284 -//  
285 -// }];  
286 -// //相册cell  
287 -// [self setAssetCellDidLayoutSubviewsBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {  
288 -// }];  
289 -// //相簿  
290 -// [self setAlbumCellDidLayoutSubviewsBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {  
291 -//  
292 -// }];  
293 -//  
294 -// //设置图片个数  
295 -// self.photoNumberIconImage = [UIImage new];  
296 - //////////////////////////////////////// 168 + //图片预览
  169 + [self setPhotoPreviewPageUIConfigBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) {
  170 +
  171 + //返回按钮
  172 + [backButton setImage:[UIImage imageNamed:@"photo_original_back"] forState:UIControlStateNormal];
  173 + //选择按钮
  174 + [selectButton setImage:[UIImage imageNamed:@"photo_original_nor"] forState:UIControlStateNormal];
  175 + [selectButton setImage:[UIImage qmui_imageWithColor:RGBOF(0x0BBE06) size:CGSizeMake(28, 28) cornerRadius:14] forState:UIControlStateSelected];
  176 + [selectButton setTitle:@"" forState:UIControlStateDisabled];
  177 +
  178 + //原图按钮
  179 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateDisabled];//禁用
  180 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_normal"] forState:UIControlStateNormal];//默认
  181 + [originalPhotoButton setImage:[UIImage imageNamed:@"photo_original_select"] forState:UIControlStateSelected];//选中
  182 + originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];
  183 + [originalPhotoButton setTitleColor:RGBOF(0xB3B3B3) forState:UIControlStateDisabled];
  184 + [originalPhotoButton setTitleColor:RGBAOF(0xFFFFFF, 0.7) forState:UIControlStateNormal];
  185 + //原图内容隐藏
  186 + originalPhotoLabel.hidden = YES;
  187 +
  188 + //完成按钮
  189 + doneButton.titleLabel.font = [UIFont systemFontOfSize:13];
  190 + [doneButton setTitle:@"完成" forState:UIControlStateDisabled];
  191 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];
  192 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];
  193 +
  194 + //颜色绘制成图片
  195 + UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];
  196 + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];
  197 + UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];
  198 + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];
  199 + doneButton.layer.masksToBounds = YES;
  200 + doneButton.layer.cornerRadius = 5;
  201 + }];
  202 +
  203 + //视频预览
  204 + [self setVideoPreviewPageUIConfigBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) {
  205 +
  206 + //完成按钮
  207 + doneButton.titleLabel.font = [UIFont systemFontOfSize:13];
  208 + [doneButton setTitle:@"完成" forState:UIControlStateDisabled];
  209 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];
  210 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];
  211 +
  212 + //颜色绘制成图片
  213 + UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];
  214 + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];
  215 + UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];
  216 + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];
  217 + doneButton.layer.masksToBounds = YES;
  218 + doneButton.layer.cornerRadius = 5;
  219 +
  220 + }];
  221 +
  222 + //gif预览
  223 + [self setGifPreviewPageUIConfigBlock:^(UIView *toolBar, UIButton *doneButton) {
  224 +
  225 + //完成按钮
  226 + doneButton.titleLabel.font = [UIFont systemFontOfSize:13];
  227 + [doneButton setTitle:@"完成" forState:UIControlStateDisabled];
  228 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];
  229 + [doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];
  230 +
  231 + //颜色绘制成图片
  232 + UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];
  233 + [doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];
  234 + UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];
  235 + [doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];
  236 + doneButton.layer.masksToBounds = YES;
  237 + doneButton.layer.cornerRadius = 5;
  238 +
  239 + }];
  240 + //相册cell
  241 + [self setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
  242 +
  243 +
  244 + }];
  245 + //相簿
  246 + [self setAlbumCellDidSetModelBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
  247 + [posterImageView setBackgroundColor:[UIColor blueColor]];
  248 + [posterImageView setBackgroundColor:[UIColor blueColor]];
  249 +
  250 + }];
  251 +
  252 +
  253 + /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等
  254 + //相册
  255 + [self setPhotoPickerPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {
  256 +
  257 + CGRect frame = bottomToolBar.frame;
  258 + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);
  259 +
  260 + CGRect originalPhotoLabelFrame = originalPhotoLabel.frame;
  261 + CGFloat originalX = (bottomToolBar.frame.size.width - originalPhotoLabelFrame.size.width) /2;
  262 + CGFloat originalY = originalPhotoLabelFrame.origin.y;
  263 + originalPhotoButton.frame = CGRectMake(originalX, originalY, originalPhotoLabelFrame.size.width, originalPhotoLabelFrame.size.height);
  264 +
  265 +
  266 + }];
  267 + //图片预览
  268 + [self setPhotoPreviewPageDidLayoutSubviewsBlock:^(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel) {
  269 +
  270 + CGRect frame = toolBar.frame;
  271 + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);
  272 +
  273 + }];
  274 + //视频预览
  275 + [self setVideoPreviewPageDidLayoutSubviewsBlock:^(UIButton *playButton, UIView *toolBar, UIButton *doneButton) {
  276 +
  277 + CGRect frame = toolBar.frame;
  278 + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);
  279 +
  280 + }];
  281 + //gif预览
  282 + [self setGifPreviewPageDidLayoutSubviewsBlock:^(UIView *toolBar, UIButton *doneButton) {
  283 +
  284 + CGRect frame = toolBar.frame;
  285 + doneButton.frame = CGRectMake(frame.size.width - 60 - 13, frame.size.height /2 - 15 - (kVerticalBottomSafeHeight /2), 60, 30);
  286 +
  287 + }];
  288 + //相册cell
  289 + [self setAssetCellDidLayoutSubviewsBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
  290 + }];
  291 + //相簿
  292 + [self setAlbumCellDidLayoutSubviewsBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
  293 +
  294 + }];
  295 +
  296 + //设置图片个数
  297 + self.photoNumberIconImage = [UIImage new];
  298 +
297 299
298 } 300 }
299 301
CNLiveImagePickerController/Classes/CNImagePickerManager.m
@@ -8,6 +8,8 @@ @@ -8,6 +8,8 @@
8 8
9 #import "CNImagePickerManager.h" 9 #import "CNImagePickerManager.h"
10 #import <AssetsLibrary/AssetsLibrary.h> 10 #import <AssetsLibrary/AssetsLibrary.h>
  11 +#import <SDAutoLayout/SDAutoLayout.h>
  12 +#import <CNLiveUploadManager/CNLiveUploadManager.h>
11 13
12 @implementation CNImagePickerManager 14 @implementation CNImagePickerManager
13 15
@@ -23,29 +25,28 @@ @@ -23,29 +25,28 @@
23 [imagePickerVc configTZImagePicker];//基本配置 25 [imagePickerVc configTZImagePicker];//基本配置
24 //特殊配置 26 //特殊配置
25 switch (enterType) { 27 switch (enterType) {
26 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
27 -// case CNImagePickerEnterTypeFriendsCircle:  
28 -// imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度  
29 -// imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度  
30 -// // 3. 设置是否可以混选选择视频/图片/原图  
31 -// imagePickerVc.allowPickingMultipleVideo = NO;  
32 -// break;  
33 -// case CNImagePickerEnterTypeComment:  
34 -//#pragma mark - TODO:根据不同设置  
35 -// break;  
36 -// case CNImagePickerEnterTypeSweepCode:  
37 -//  
38 -// break;  
39 -// case CNImagePickerEnterTypeChat:  
40 -//  
41 -// break;  
42 -// case CNImagePickerEnterTypeWitness:  
43 -// imagePickerVc.allowPickingImage = NO;// 显示图片  
44 -// imagePickerVc.allowPickingMultipleVideo = NO;  
45 -// imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度  
46 -// imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度  
47 -// break;  
48 - ////////////////////////////// 28 +
  29 + case CNImagePickerEnterTypeFriendsCircle:
  30 + imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度
  31 + imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度
  32 + // 3. 设置是否可以混选选择视频/图片/原图
  33 + imagePickerVc.allowPickingMultipleVideo = NO;
  34 + break;
  35 + case CNImagePickerEnterTypeComment:
  36 +#pragma mark - TODO:根据不同设置
  37 + break;
  38 + case CNImagePickerEnterTypeSweepCode:
  39 +
  40 + break;
  41 + case CNImagePickerEnterTypeChat:
  42 +
  43 + break;
  44 + case CNImagePickerEnterTypeWitness:
  45 + imagePickerVc.allowPickingImage = NO;// 显示图片
  46 + imagePickerVc.allowPickingMultipleVideo = NO;
  47 + imagePickerVc.maxEditVideoTime = kFriendsCircle_limit_video_maxEdit;//编辑长度
  48 + imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max;//编辑视频最大长度
  49 + break;
49 case CNImagePickedEnterTypeField: 50 case CNImagePickedEnterTypeField:
50 imagePickerVc.allowPickingImage = YES;// 显示图片 51 imagePickerVc.allowPickingImage = YES;// 显示图片
51 imagePickerVc.allowPickingMultipleVideo = NO; 52 imagePickerVc.allowPickingMultipleVideo = NO;
@@ -62,12 +63,11 @@ @@ -62,12 +63,11 @@
62 /// 5. Single selection mode, valid when maxImagesCount = 1 63 /// 5. Single selection mode, valid when maxImagesCount = 1
63 /// 5. 单选模式,maxImagesCount为1时才生效 64 /// 5. 单选模式,maxImagesCount为1时才生效
64 // 设置竖屏下的裁剪尺寸 65 // 设置竖屏下的裁剪尺寸
65 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
66 -// NSInteger left = 30;  
67 -// NSInteger widthHeight = vc.view.width - 2 * left;  
68 -// NSInteger top = (vc.view.height - widthHeight) / 2;  
69 -// imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight);  
70 - //////////////////////// 66 +
  67 + NSInteger left = 30;
  68 + NSInteger widthHeight = vc.view.width - 2 * left;
  69 + NSInteger top = (vc.view.height - widthHeight) / 2;
  70 + imagePickerVc.cropRect = CGRectMake(left, top, widthHeight, widthHeight);
71 // 你可以通过block或者代理,来得到用户选择的照片. 71 // 你可以通过block或者代理,来得到用户选择的照片.
72 [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) { 72 [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
73 // 回调参数 73 // 回调参数
CNLiveImagePickerController/Classes/TZImageManager.m
@@ -10,6 +10,9 @@ @@ -10,6 +10,9 @@
10 #import <AssetsLibrary/AssetsLibrary.h> 10 #import <AssetsLibrary/AssetsLibrary.h>
11 #import "TZAssetModel.h" 11 #import "TZAssetModel.h"
12 #import "TZImagePickerController.h" 12 #import "TZImagePickerController.h"
  13 +#import <CNLiveBusinessTools/CNLiveBusinessTools.h>
  14 +#import <CNLiveUserManagement/CNUserInfoModel.h>
  15 +#import <CNLiveUserManagement/CNUserInfoManager.h>
13 16
14 @interface TZImageManager () 17 @interface TZImageManager ()
15 #pragma clang diagnostic push 18 #pragma clang diagnostic push
@@ -887,16 +890,15 @@ static dispatch_once_t onceToken; @@ -887,16 +890,15 @@ static dispatch_once_t onceToken;
887 // NSString *outputPath = [NSHomeDirectory() stringByAppendingFormat:@"/tmp/output-%@.mp4", [formater stringFromDate:[NSDate date]]]; 890 // NSString *outputPath = [NSHomeDirectory() stringByAppendingFormat:@"/tmp/output-%@.mp4", [formater stringFromDate:[NSDate date]]];
888 NSString *outputPath = @""; 891 NSString *outputPath = @"";
889 if (self.conversationId) { 892 if (self.conversationId) {
890 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
891 -// outputPath = [[CNLiveBusinessTools newChatFilePathByUserId:self.conversationId] stringByAppendingPathComponent:filaName];//聊天  
892 - /////////////// 893 +
  894 + outputPath = [[CNLiveBusinessTools newChatFilePathByUserId:self.conversationId] stringByAppendingPathComponent:filaName];//聊天
893 895
894 } 896 }
895 else 897 else
896 { 898 {
897 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
898 -// outputPath = [[CNLiveBusinessTools chatFilePathByUserId:[IMAPlatform sharedInstance].host.userId] stringByAppendingString:filaName];//朋友圈  
899 - /////////// 899 +
  900 + outputPath = [[CNLiveBusinessTools chatFilePathByUserId:CNUserShareModel.uid] stringByAppendingString:filaName];//朋友圈
  901 +
900 } 902 }
901 NSLog(@"video outputPath = %@",outputPath); 903 NSLog(@"video outputPath = %@",outputPath);
902 904
CNLiveImagePickerController/Classes/TZPhotoPickerController.m
@@ -18,9 +18,10 @@ @@ -18,9 +18,10 @@
18 #import "TZLocationManager.h" 18 #import "TZLocationManager.h"
19 #import <MobileCoreServices/MobileCoreServices.h> 19 #import <MobileCoreServices/MobileCoreServices.h>
20 #import <AssetsLibrary/AssetsLibrary.h>///lxg 20 #import <AssetsLibrary/AssetsLibrary.h>///lxg
21 -#pragma mark - TODO: 2019.11.12 需要其他库依赖  
22 -//#import "CNLiveUploadManager.h"  
23 -/////////// 21 +
  22 +#import <CNLiveUploadManager/CNLiveUploadManager.h>
  23 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  24 +
24 @implementation PHAsset (Qiniu) 25 @implementation PHAsset (Qiniu)
25 26
26 - (NSURL *)movieURL { 27 - (NSURL *)movieURL {
@@ -698,15 +699,27 @@ static CGFloat itemMargin = 5; @@ -698,15 +699,27 @@ static CGFloat itemMargin = 5;
698 699
699 __block NSURL *returnURL = nil; 700 __block NSURL *returnURL = nil;
700 TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; 701 TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
701 -#pragma mark - TODO: 2019.11.12 需要其他库依赖  
702 -// [CNLiveUploadManager zipNewVideoWithAsset:model.asset conversationId:tzImagePickerVc.conversationId limitType:AppPhototLimitTypeChat progressCount:^(float progress) {  
703 -//  
704 -// } success:^(NSURL *url) {  
705 -// returnURL = url;  
706 -// } failure:^{  
707 -//  
708 -// }];  
709 - //////////// 702 +
  703 + NSString *outputPath = @"";
  704 + NSDateFormatter *formater = [[NSDateFormatter alloc] init];
  705 + NSInteger rand = random();
  706 + NSString *filaName = [NSString stringWithFormat:@"output-%@_fileType=videoType_%ld.mp4",[formater stringFromDate:[NSDate date]],rand];
  707 +
  708 + if ([NSString isEmpty:tzImagePickerVc.conversationId]) {
  709 + outputPath = [[CNLiveBusinessTools chatFilePathByUserId:CNUserShareModel.uid] stringByAppendingString:filaName];
  710 + }else{
  711 + outputPath = [[CNLiveBusinessTools newChatFilePathByUserId:tzImagePickerVc.conversationId] stringByAppendingPathComponent:filaName];
  712 +
  713 + }
  714 +
  715 + [CNLiveUploadManager zipNewVideoWithAsset:model.asset outputPath:outputPath limitType:AppPhototLimitTypeChat progressCount:^(float progress) {
  716 +
  717 + } success:^(NSURL *url) {
  718 + returnURL = url;
  719 + } failure:^{
  720 +
  721 + }];
  722 +
710 723
711 return returnURL; 724 return returnURL;
712 725
CNLiveImagePickerController/Classes/TZVideoPlayerController.m
@@ -13,6 +13,9 @@ @@ -13,6 +13,9 @@
13 #import "TZAssetModel.h" 13 #import "TZAssetModel.h"
14 #import "TZImagePickerController.h" 14 #import "TZImagePickerController.h"
15 #import "TZPhotoPreviewController.h" 15 #import "TZPhotoPreviewController.h"
  16 +#import <QMUIKit/QMUIKit.h>
  17 +#import <CNLiveBaseKit/CNLiveBaseKit.h>
  18 +
16 #pragma mark - TODO: 2019.11.12 需要其他库依赖 19 #pragma mark - TODO: 2019.11.12 需要其他库依赖
17 //#import "CNAudioOrVideoMananger.h" 20 //#import "CNAudioOrVideoMananger.h"
18 //#import "CNLiveSoundManager.h" 21 //#import "CNLiveSoundManager.h"
@@ -199,16 +202,15 @@ @@ -199,16 +202,15 @@
199 //完成按钮 202 //完成按钮
200 _doneButton.titleLabel.font = [UIFont systemFontOfSize:13]; 203 _doneButton.titleLabel.font = [UIFont systemFontOfSize:13];
201 [_doneButton setTitle:@"完成" forState:UIControlStateDisabled]; 204 [_doneButton setTitle:@"完成" forState:UIControlStateDisabled];
202 - #pragma mark - TODO: 2019.11.12 需要其他库依赖  
203 -// [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];  
204 -// [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal]; 205 + [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateDisabled];
  206 + [_doneButton setTitleColor:RGBOF(0xFFFFFF) forState:UIControlStateNormal];
205 207
206 -// //颜色绘制成图片  
207 -// UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];  
208 -// [_doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];  
209 -// UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];  
210 -// [_doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];  
211 - ///////////////////////// 208 + //颜色绘制成图片
  209 + UIImage *dis_image = [UIImage qmui_imageWithColor:RGBAOF(0x0BBE06, 0.5)];
  210 + [_doneButton setBackgroundImage:dis_image forState:UIControlStateSelected];
  211 + UIImage *nor_image = [UIImage qmui_imageWithColor:RGBOF(0x0BBE06)];
  212 + [_doneButton setBackgroundImage:nor_image forState:UIControlStateNormal];
  213 +
212 _doneButton.layer.masksToBounds = YES; 214 _doneButton.layer.masksToBounds = YES;
213 _doneButton.layer.cornerRadius = 5; 215 _doneButton.layer.cornerRadius = 5;
214 CGRect frame = _toolBar.frame; 216 CGRect frame = _toolBar.frame;
Example/CNLiveImagePickerController.xcodeproj/project.pbxproj
@@ -305,17 +305,45 @@ @@ -305,17 +305,45 @@
305 ); 305 );
306 inputPaths = ( 306 inputPaths = (
307 "${PODS_ROOT}/Target Support Files/Pods-CNLiveImagePickerController_Example/Pods-CNLiveImagePickerController_Example-frameworks.sh", 307 "${PODS_ROOT}/Target Support Files/Pods-CNLiveImagePickerController_Example/Pods-CNLiveImagePickerController_Example-frameworks.sh",
  308 + "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
308 "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework", 309 "${BUILT_PRODUCTS_DIR}/CNLiveBaseKit/CNLiveBaseKit.framework",
  310 + "${BUILT_PRODUCTS_DIR}/CNLiveBaseTools/CNLiveBaseTools.framework",
  311 + "${BUILT_PRODUCTS_DIR}/CNLiveBusinessTools/CNLiveBusinessTools.framework",
  312 + "${BUILT_PRODUCTS_DIR}/CNLiveCommonCategory/CNLiveCommonCategory.framework",
  313 + "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
309 "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework", 314 "${BUILT_PRODUCTS_DIR}/CNLiveImagePickerController/CNLiveImagePickerController.framework",
  315 + "${BUILT_PRODUCTS_DIR}/CNLiveRequestBastKit/CNLiveRequestBastKit.framework",
310 "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework", 316 "${BUILT_PRODUCTS_DIR}/CNLiveTripartiteManagement/CNLiveTripartiteManagement.framework",
  317 + "${BUILT_PRODUCTS_DIR}/CNLiveUploadManager/CNLiveUploadManager.framework",
  318 + "${BUILT_PRODUCTS_DIR}/CNLiveUserManagement/CNLiveUserManagement.framework",
  319 + "${BUILT_PRODUCTS_DIR}/HappyDNS/HappyDNS.framework",
311 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework", 320 "${BUILT_PRODUCTS_DIR}/MJExtension/MJExtension.framework",
  321 + "${BUILT_PRODUCTS_DIR}/QMUIKit/QMUIKit.framework",
  322 + "${BUILT_PRODUCTS_DIR}/Qiniu/Qiniu.framework",
  323 + "${BUILT_PRODUCTS_DIR}/SDAutoLayout/SDAutoLayout.framework",
  324 + "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework",
  325 + "${BUILT_PRODUCTS_DIR}/YYKit/YYKit.framework",
312 ); 326 );
313 name = "[CP] Embed Pods Frameworks"; 327 name = "[CP] Embed Pods Frameworks";
314 outputPaths = ( 328 outputPaths = (
  329 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
315 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework", 330 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseKit.framework",
  331 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBaseTools.framework",
  332 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBusinessTools.framework",
  333 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCommonCategory.framework",
  334 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
316 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework", 335 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveImagePickerController.framework",
  336 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveRequestBastKit.framework",
317 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework", 337 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveTripartiteManagement.framework",
  338 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUploadManager.framework",
  339 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveUserManagement.framework",
  340 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HappyDNS.framework",
318 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework", 341 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MJExtension.framework",
  342 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/QMUIKit.framework",
  343 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Qiniu.framework",
  344 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDAutoLayout.framework",
  345 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework",
  346 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YYKit.framework",
319 ); 347 );
320 runOnlyForDeploymentPostprocessing = 0; 348 runOnlyForDeploymentPostprocessing = 0;
321 shellPath = /bin/sh; 349 shellPath = /bin/sh;
Example/Podfile
@@ -7,7 +7,9 @@ platform :ios, &#39;9.0&#39; @@ -7,7 +7,9 @@ platform :ios, &#39;9.0&#39;
7 target 'CNLiveImagePickerController_Example' do 7 target 'CNLiveImagePickerController_Example' do
8 pod 'CNLiveImagePickerController', :path => '../' 8 pod 'CNLiveImagePickerController', :path => '../'
9 9
10 -# pod 'CNLiveBaseKit' 10 + #依赖三方私有库,如果里面有.a的时候加上这个
  11 + pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  12 + end
11 13
12 target 'CNLiveImagePickerController_Tests' do 14 target 'CNLiveImagePickerController_Tests' do
13 inherit! :search_paths 15 inherit! :search_paths