Commit 5374616aa279f36055eadd361cbdb5f691a01f64

Authored by daojian
1 parent b1cd0c87

0.0.25 版本 修改类名称

Showing 65 changed files with 850 additions and 853 deletions

Too many changes to show.

To preserve performance only 65 of 78 files are displayed.

CNLiveImagePickerController.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveImagePickerController'
11   - s.version = '0.0.24'
  11 + s.version = '0.0.25'
12 12 s.summary = '相册'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveImagePickerController/Classes/CNEditVideoController.h
... ... @@ -8,11 +8,11 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -@class TZAssetModel;
  11 +@class CNTZAssetModel;
12 12  
13 13 @interface CNEditVideoController : UIViewController
14 14  
15   -@property (nonatomic, strong) TZAssetModel *model;
  15 +@property (nonatomic, strong) CNTZAssetModel *model;
16 16  
17 17 @property (nonatomic, strong) NSMutableArray *models; ///< All photo models / 所有图片模型数组
18 18 @property (nonatomic, strong) NSMutableArray *photos; ///< All photos / 所有图片数组
... ...
CNLiveImagePickerController/Classes/CNEditVideoController.m
... ... @@ -8,12 +8,12 @@
8 8  
9 9 #import "CNEditVideoController.h"
10 10 #import <AVFoundation/AVFoundation.h>
11   -#import "TZAssetModel.h"
  11 +#import "CNTZAssetModel.h"
12 12 #import <objc/runtime.h>
13 13 #import <AssetsLibrary/AssetsLibrary.h>
14   -#import "TZImagePickerController.h"
15   -#import "TZPhotoPreviewCell.h"
16   -#import "TZImageCropManager.h"
  14 +#import "CNTZImagePickerController.h"
  15 +#import "CNTZPhotoPreviewCell.h"
  16 +#import "CNTZImageCropManager.h"
17 17 #import <SDAutoLayout/SDAutoLayout.h>
18 18 #import <CNLiveBaseKit/CNLiveBaseKit.h>
19 19  
... ... @@ -422,8 +422,8 @@
422 422 duration = [[self.model.asset valueForProperty:ALAssetPropertyDuration] doubleValue];
423 423 }
424 424  
425   - TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
426   - _interval = _tzImagePickerVc.maxEditVideoTime/10.0;
  425 + CNTZImagePickerController *_CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  426 + _interval = _CNTZImagePickerVc.maxEditVideoTime/10.0;
427 427 _measureCount = (NSInteger)(duration / _interval);
428 428 ///播放视频的
429 429 if ([self.model.asset isKindOfClass:[PHAsset class]]) {//PHAsset
... ... @@ -484,8 +484,8 @@
484 484 }
485 485  
486 486 if (self.backButtonEditClickBlock) {
487   - TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
488   - self.backButtonEditClickBlock(_tzImagePickerVc.isSelectOriginalPhoto);
  487 + CNTZImagePickerController *_CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  488 + self.backButtonEditClickBlock(_CNTZImagePickerVc.isSelectOriginalPhoto);
489 489 }
490 490 UIViewController *vc = [self.navigationController popViewControllerAnimated:NO];
491 491 if (!vc) {
... ... @@ -506,43 +506,43 @@
506 506  
507 507  
508 508  
509   - TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
510   - [_tzImagePickerVc showProgressHUD];
  509 + CNTZImagePickerController *_CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  510 + [_CNTZImagePickerVc showProgressHUD];
511 511 _doneBtn.enabled = NO;
512 512 _cancelBtn.enabled = NO;
513 513 __weak typeof(self) weakSelf = self;
514 514  
515 515 if (!_avAsset) {
516   - [_tzImagePickerVc hideProgressHUD];
517   - [_tzImagePickerVc showAlertWithTitle:@"编辑视频失败"];
  516 + [_CNTZImagePickerVc hideProgressHUD];
  517 + [_CNTZImagePickerVc showAlertWithTitle:@"编辑视频失败"];
518 518 _doneBtn.enabled = YES;
519 519 _cancelBtn.enabled = YES;
520 520 return;
521 521 }
522 522 [self exportEditVideoForAsset:_avAsset range:[self getTimeRange] complete:^(BOOL isSuc, id asset) {
523   - [_tzImagePickerVc hideProgressHUD];
  523 + [_CNTZImagePickerVc hideProgressHUD];
524 524  
525 525 if (isSuc) {
526 526 [self stopPlay];
527   - [_tzImagePickerVc showProgressHUD];
528   - TZAssetModel *editModel = [TZAssetModel modelWithAsset:asset type:TZAssetModelMediaTypeVideo];
  527 + [_CNTZImagePickerVc showProgressHUD];
  528 + CNTZAssetModel *editModel = [CNTZAssetModel modelWithAsset:asset type:CNTZAssetModelMediaTypeVideo];
529 529  
530 530 // 如果没有选中过照片 点击确定时选中当前预览的照片
531   - if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0) {
532   - [_tzImagePickerVc addSelectedModel:editModel];
  531 + if (_CNTZImagePickerVc.selectedModels.count == 0 && _CNTZImagePickerVc.minImagesCount <= 0) {
  532 + [_CNTZImagePickerVc addSelectedModel:editModel];
533 533 }
534 534  
535 535 if (weakSelf.doneButtonEditClickBlock) {
536   - weakSelf.doneButtonEditClickBlock(_tzImagePickerVc.isSelectOriginalPhoto);
  536 + weakSelf.doneButtonEditClickBlock(_CNTZImagePickerVc.isSelectOriginalPhoto);
537 537 }
538   - [_tzImagePickerVc hideProgressHUD];
  538 + [_CNTZImagePickerVc hideProgressHUD];
539 539 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
540 540 self->_doneBtn.enabled = YES;
541 541 self->_cancelBtn.enabled = YES;
542 542 });
543 543  
544 544 }else{
545   - [_tzImagePickerVc showAlertWithTitle:@"编辑失败"];
  545 + [_CNTZImagePickerVc showAlertWithTitle:@"编辑失败"];
546 546 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
547 547 self->_doneBtn.enabled = YES;
548 548 self->_cancelBtn.enabled = YES;
... ...
CNLiveImagePickerController/Classes/CNImagePickerController.h
1 1 //
2   -// CNTZImagePickerControllerViewController.h
  2 +// CNCNTZImagePickerControllerViewController.h
3 3 // CNLiveNetAdd
4 4 //
5 5 // Created by 梁星国 on 2018/8/22.
6 6 // Copyright © 2018年 cnlive. All rights reserved.
7 7 //
8 8  
9   -#import "TZImagePickerController.h"
  9 +#import "CNTZImagePickerController.h"
10 10  
11   -@interface CNImagePickerController : TZImagePickerController
  11 +@interface CNImagePickerController : CNTZImagePickerController
12 12  
13 13 /**
14 14 配置
15 15 */
16   -- (void)configTZImagePicker;
  16 +- (void)configCNTZImagePicker;
17 17  
18 18 @end
... ...
CNLiveImagePickerController/Classes/CNImagePickerController.m
1 1 //
2   -// CNTZImagePickerControllerViewController.m
  2 +// CNCNTZImagePickerControllerViewController.m
3 3 // CNLiveNetAdd
4 4 //
5 5 // Created by 梁星国 on 2018/8/22.
... ... @@ -24,7 +24,7 @@
24 24 /**
25 25 配置
26 26 */
27   -- (void)configTZImagePicker{
  27 +- (void)configCNTZImagePicker{
28 28  
29 29 // imagePickerVc.navigationBar.translucent = NO;
30 30  
... ... @@ -77,7 +77,7 @@
77 77 self.allowCrop = NO;
78 78 self.needCircleCrop = NO;
79 79 // 设置横屏下的裁剪尺寸
80   - // imagePickerVc.cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, left, widthHeight, widthHeight);
  80 + // imagePickerVc.cropRectLandscape = CGRectMake((self.view.CNTZ_height - widthHeight) / 2, left, widthHeight, widthHeight);
81 81 /*
82 82 [imagePickerVc setCropViewSettingBlock:^(UIView *cropView) {
83 83 cropView.layer.borderColor = [UIColor redColor].CGColor;
... ... @@ -115,7 +115,7 @@
115 115 // imagePickerVc.preferredLanguage = @"zh-Hans";
116 116  
117 117 // 设置languageBundle以使用其它语言 / Set languageBundle to use other language
118   - // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]];
  118 + // imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"CNTZ-ru" ofType:@"lproj"]];
119 119  
120 120 /// 【自定义各页面/组件的样式】在界面初始化/组件setModel完成后调用,允许外界修改样式等
121 121 //相册
... ... @@ -238,12 +238,12 @@
238 238  
239 239 }];
240 240 //相册cell
241   - [self setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
  241 + [self setAssetCellDidSetModelBlock:^(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
242 242  
243 243  
244 244 }];
245 245 //相簿
246   - [self setAlbumCellDidSetModelBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
  246 + [self setAlbumCellDidSetModelBlock:^(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
247 247 [posterImageView setBackgroundColor:[UIColor whiteColor]];
248 248  
249 249 }];
... ... @@ -285,10 +285,10 @@
285 285  
286 286 }];
287 287 //相册cell
288   - [self setAssetCellDidLayoutSubviewsBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
  288 + [self setAssetCellDidLayoutSubviewsBlock:^(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
289 289 }];
290 290 //相簿
291   - [self setAlbumCellDidLayoutSubviewsBlock:^(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
  291 + [self setAlbumCellDidLayoutSubviewsBlock:^(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel) {
292 292  
293 293 }];
294 294  
... ...
CNLiveImagePickerController/Classes/CNImagePickerManager.h
... ... @@ -13,7 +13,7 @@
13 13 #pragma mark - TODO: 导出
14 14 typedef void (^didFinishPickingPhotosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);//选着图片返回
15 15  
16   -typedef void (^didNewFinishPickingPhotosHandle) (NSArray<UIImage *> *photos,NSArray<TZAssetModel *> *models,NSArray *assets,BOOL isSelectOriginalPhoto);
  16 +typedef void (^didNewFinishPickingPhotosHandle) (NSArray<UIImage *> *photos,NSArray<CNTZAssetModel *> *models,NSArray *assets,BOOL isSelectOriginalPhoto);
17 17  
18 18 //typedef void (^failureBlock)(NSMutableArray* errorArray, NSError *error);//失败数组,错误
19 19  
... ... @@ -37,20 +37,20 @@ typedef NS_ENUM(NSUInteger, CNImagePickerEnterType) {
37 37  
38 38 @param maxImagesCount 最大图片
39 39 @param columnNumber 列个数
40   - @param delegate 代理(UIViewController<TZImagePickerControllerDelegate>)
  40 + @param delegate 代理(UIViewController<CNTZImagePickerControllerDelegate>)
41 41 @param pushPhotoPickerVc 是否跳转到相册
42 42 @param isSelectOriginalPhoto 是否原图
43 43 @param selectedAssets 选择图片
44 44 @param enterType 进入方式
45 45 @param pickingPhotosHandle 选择结束回调
46 46 */
47   -+ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto selectedAssets:(NSMutableArray *)selectedAssets enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle;
  47 ++ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto selectedAssets:(NSMutableArray *)selectedAssets enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle;
48 48  
49 49 /**
50 50 预览图片
51 51  
52 52 @param maxImagesCount 最大限制
53   - @param delegate 代理(UIViewController<TZImagePickerControllerDelegate>)
  53 + @param delegate 代理(UIViewController<CNTZImagePickerControllerDelegate>)
54 54 @param selectedAssets 选中Assets
55 55 @param selectedPhotos 选中Photos
56 56 @param index 选中第几个
... ... @@ -58,29 +58,29 @@ typedef NS_ENUM(NSUInteger, CNImagePickerEnterType) {
58 58 @param enterType 进入方式
59 59 @param pickingPhotosHandle 回调参数
60 60 */
61   -+ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate selectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle;
  61 ++ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<CNTZImagePickerControllerDelegate>)delegate selectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle;
62 62  
63 63  
64 64 /**
65 65 预览单个视频
66 66  
67 67 @param selectedAsset 选择视频
68   - @param delegate 代理(UIViewController<TZImagePickerControllerDelegate>)
  68 + @param delegate 代理(UIViewController<CNTZImagePickerControllerDelegate>)
69 69 */
70   -+ (void)ImagePickerWithSelectedAsset:(id)selectedAsset delegate:(id<TZImagePickerControllerDelegate>)delegate;
  70 ++ (void)ImagePickerWithSelectedAsset:(id)selectedAsset delegate:(id<CNTZImagePickerControllerDelegate>)delegate;
71 71  
72 72  
73 73 /**
74 74 保存图片
75 75  
76   - @param delegate 代理(UIViewController<TZImagePickerControllerDelegate>)
  76 + @param delegate 代理(UIViewController<CNTZImagePickerControllerDelegate>)
77 77 @param image 图片
78 78 @param location 地点
79 79 @param success 成功
80 80 @param failure 失败
81 81  
82 82 */
83   -+(void)ImageManagerSavePhotoWithDelegate:(id<TZImagePickerControllerDelegate>)delegate image:(UIImage *)image location:(CLLocation *)location success:(void (^)(TZAssetModel *assetModel))success failure:(void (^)(NSError *error))failure;
  83 ++(void)ImageManagerSavePhotoWithDelegate:(id<CNTZImagePickerControllerDelegate>)delegate image:(UIImage *)image location:(CLLocation *)location success:(void (^)(CNTZAssetModel *assetModel))success failure:(void (^)(NSError *error))failure;
84 84  
85 85  
86 86 /**
... ... @@ -89,7 +89,7 @@ typedef NS_ENUM(NSUInteger, CNImagePickerEnterType) {
89 89 @param asset asset
90 90 @return 返回类型
91 91 */
92   -+ (TZAssetModelMediaType)getAssetType:(id)asset;
  92 ++ (CNTZAssetModelMediaType)getAssetType:(id)asset;
93 93  
94 94  
95 95 @end
... ...
CNLiveImagePickerController/Classes/CNImagePickerManager.m
... ... @@ -14,7 +14,7 @@
14 14 @implementation CNImagePickerManager
15 15  
16 16 /// 打开相册选择图片
17   -+ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto selectedAssets:(NSMutableArray *)selectedAssets enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle{
  17 ++ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto selectedAssets:(NSMutableArray *)selectedAssets enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle{
18 18  
19 19 if (![delegate isKindOfClass:[UIViewController class]]) {
20 20 return;
... ... @@ -22,7 +22,7 @@
22 22 UIViewController *vc = (UIViewController *)delegate;
23 23  
24 24 CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithMaxImagesCount:maxImagesCount columnNumber:columnNumber delegate:delegate pushPhotoPickerVc:pushPhotoPickerVc];
25   - [imagePickerVc configTZImagePicker];//基本配置
  25 + [imagePickerVc configCNTZImagePicker];//基本配置
26 26 //特殊配置
27 27 switch (enterType) {
28 28  
... ... @@ -31,6 +31,8 @@
31 31 imagePickerVc.maxVideoDuration = kFriendsCircle_limit_video_max_upload;//编辑视频最大长度
32 32 // 3. 设置是否可以混选选择视频/图片/原图
33 33 imagePickerVc.allowPickingMultipleVideo = NO;
  34 + //4.选择一张图片情况下不可选视频
  35 + imagePickerVc.allowPickingVideo = NO;
34 36 break;
35 37 case CNImagePickerEnterTypeComment:
36 38 #pragma mark - TODO:根据不同设置
... ... @@ -80,7 +82,7 @@
80 82 NSLog(@"输出infos = %@",infos);
81 83 }];
82 84  
83   - [imagePickerVc setDidNewFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray<TZAssetModel *> *models, NSArray *assets, BOOL isSelectOriginalPhoto) {
  85 + [imagePickerVc setDidNewFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray<CNTZAssetModel *> *models, NSArray *assets, BOOL isSelectOriginalPhoto) {
84 86 NSLog(@"输出models = %@",models);
85 87 }];
86 88  
... ... @@ -88,7 +90,7 @@
88 90 }
89 91  
90 92 /// 预览图片
91   -+ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate selectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle {
  93 ++ (void)ImagePickerWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<CNTZImagePickerControllerDelegate>)delegate selectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto enterType:(CNImagePickerEnterType )enterType pickingPhotosHandle:(didFinishPickingPhotosHandle) pickingPhotosHandle {
92 94  
93 95 if (![delegate isKindOfClass:[UIViewController class]]) {
94 96 return;
... ... @@ -96,7 +98,7 @@
96 98 UIViewController *vc = (UIViewController *)delegate;
97 99  
98 100 CNImagePickerController *imagePickerVc = [[CNImagePickerController alloc] initWithSelectedAssets:selectedAssets selectedPhotos:selectedPhotos index:index];
99   - [imagePickerVc configTZImagePicker];//基本配置
  101 + [imagePickerVc configCNTZImagePicker];//基本配置
100 102 imagePickerVc.modalPresentationStyle = UIModalPresentationFullScreen;
101 103 //特殊配置
102 104 switch (enterType) {
... ... @@ -136,15 +138,15 @@
136 138 }
137 139  
138 140 /// 预览单个视频
139   -+ (void)ImagePickerWithSelectedAsset:(id)selectedAsset delegate:(id<TZImagePickerControllerDelegate>)delegate {
  141 ++ (void)ImagePickerWithSelectedAsset:(id)selectedAsset delegate:(id<CNTZImagePickerControllerDelegate>)delegate {
140 142  
141 143 if (![delegate isKindOfClass:[UIViewController class]]) {
142 144 return;
143 145 }
144 146 UIViewController *vc = (UIViewController *)delegate;
145 147  
146   - TZVideoPlayerController *videoVC = [[TZVideoPlayerController alloc] init];
147   - TZAssetModel *model = [TZAssetModel modelWithAsset:selectedAsset type:TZAssetModelMediaTypeVideo timeLength:@""];
  148 + CNTZVideoPlayerController *videoVC = [[CNTZVideoPlayerController alloc] init];
  149 + CNTZAssetModel *model = [CNTZAssetModel modelWithAsset:selectedAsset type:CNTZAssetModelMediaTypeVideo timeLength:@""];
148 150 videoVC.isOther = YES;//(LXG)相册外进入
149 151 videoVC.model = model;
150 152 videoVC.modalPresentationStyle = UIModalPresentationFullScreen;
... ... @@ -153,19 +155,19 @@
153 155 }
154 156  
155 157 /// 返回类型
156   -+ (TZAssetModelMediaType)getAssetType:(id)asset {
  158 ++ (CNTZAssetModelMediaType)getAssetType:(id)asset {
157 159  
158   - TZAssetModelMediaType type = TZAssetModelMediaTypePhoto;
  160 + CNTZAssetModelMediaType type = CNTZAssetModelMediaTypePhoto;
159 161 if ([asset isKindOfClass:[PHAsset class]]) {
160 162 PHAsset *phAsset = (PHAsset *)asset;
161   - if (phAsset.mediaType == PHAssetMediaTypeVideo) type = TZAssetModelMediaTypeVideo;
162   - else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = TZAssetModelMediaTypeAudio;
  163 + if (phAsset.mediaType == PHAssetMediaTypeVideo) type = CNTZAssetModelMediaTypeVideo;
  164 + else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = CNTZAssetModelMediaTypeAudio;
163 165 else if (phAsset.mediaType == PHAssetMediaTypeImage) {
164 166 if (iOS9_1Later) {
165 167 if (@available(iOS 9.1, *)) {
166 168 if (phAsset.mediaSubtypes == PHAssetMediaSubtypePhotoLive)
167 169 {
168   - type = TZAssetModelMediaTypeLivePhoto;
  170 + type = CNTZAssetModelMediaTypeLivePhoto;
169 171 }
170 172 } else {
171 173 // Fallback on earlier versions
... ... @@ -173,38 +175,38 @@
173 175 }
174 176 // Gif
175 177 if ([[phAsset valueForKey:@"filename"] hasSuffix:@"GIF"]) {
176   - type = TZAssetModelMediaTypePhotoGif;
  178 + type = CNTZAssetModelMediaTypePhotoGif;
177 179 }
178 180 }
179 181 } else {
180 182 if ([[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]) {
181   - type = TZAssetModelMediaTypeVideo;
  183 + type = CNTZAssetModelMediaTypeVideo;
182 184 }
183 185 }
184 186 return type;
185 187 }
186 188  
187 189  
188   -+(void)ImageManagerSavePhotoWithDelegate:(id<TZImagePickerControllerDelegate>)delegate image:(UIImage *)image location:(CLLocation *)location success:(void (^)(TZAssetModel *assetModel))success failure:(void (^)(NSError *error))failure {
  190 ++(void)ImageManagerSavePhotoWithDelegate:(id<CNTZImagePickerControllerDelegate>)delegate image:(UIImage *)image location:(CLLocation *)location success:(void (^)(CNTZAssetModel *assetModel))success failure:(void (^)(NSError *error))failure {
189 191  
190   - TZImagePickerController *tzImagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:delegate];
191   - tzImagePickerVc.sortAscendingByModificationDate = YES;
  192 + CNTZImagePickerController *CNTZImagePickerVc = [[CNTZImagePickerController alloc] initWithMaxImagesCount:1 delegate:delegate];
  193 + CNTZImagePickerVc.sortAscendingByModificationDate = YES;
192 194  
193   - [tzImagePickerVc showProgressHUD];
  195 + [CNTZImagePickerVc showProgressHUD];
194 196 // save photo and get asset / 保存图片,获取到asset
195   - [[TZImageManager manager] savePhotoWithImage:image location:location completion:^(NSError *error){
  197 + [[CNTZImageManager manager] savePhotoWithImage:image location:location completion:^(NSError *error){
196 198  
197 199 if (error) {
198   - [tzImagePickerVc hideProgressHUD];
  200 + [CNTZImagePickerVc hideProgressHUD];
199 201 failure(error);
200 202 NSLog(@"图片保存失败 %@",error);
201 203 } else {
202 204  
203   - [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(TZAlbumModel *model) {
204   - [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) {
205   - [tzImagePickerVc hideProgressHUD];
206   - TZAssetModel *assetModel = [models firstObject];
207   - if (tzImagePickerVc.sortAscendingByModificationDate) {
  205 + [[CNTZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:YES completion:^(CNTZAlbumModel *model) {
  206 + [[CNTZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<CNTZAssetModel *> *models) {
  207 + [CNTZImagePickerVc hideProgressHUD];
  208 + CNTZAssetModel *assetModel = [models firstObject];
  209 + if (CNTZImagePickerVc.sortAscendingByModificationDate) {
208 210 assetModel = [models lastObject];
209 211 }
210 212 success(assetModel);
... ...
CNLiveImagePickerController/Classes/TZAssetCell.h renamed to CNLiveImagePickerController/Classes/CNTZAssetCell.h
1 1 //
2   -// TZAssetCell.h
3   -// TZImagePickerController
  2 +// CNTZAssetCell.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
... ... @@ -10,21 +10,21 @@
10 10 #import <Photos/Photos.h>
11 11  
12 12 typedef enum : NSUInteger {
13   - TZAssetCellTypePhoto = 0,
14   - TZAssetCellTypeLivePhoto,
15   - TZAssetCellTypePhotoGif,
16   - TZAssetCellTypeVideo,
17   - TZAssetCellTypeAudio,
18   -} TZAssetCellType;
19   -
20   -@class TZAssetModel;
21   -@interface TZAssetCell : UICollectionViewCell
  13 + CNTZAssetCellTypePhoto = 0,
  14 + CNTZAssetCellTypeLivePhoto,
  15 + CNTZAssetCellTypePhotoGif,
  16 + CNTZAssetCellTypeVideo,
  17 + CNTZAssetCellTypeAudio,
  18 +} CNTZAssetCellType;
  19 +
  20 +@class CNTZAssetModel;
  21 +@interface CNTZAssetCell : UICollectionViewCell
22 22 @property (weak, nonatomic) UIButton *selectPhotoButton;
23 23 @property (weak, nonatomic) UIButton *cannotSelectLayerButton;
24   -@property (nonatomic, strong) TZAssetModel *model;
  24 +@property (nonatomic, strong) CNTZAssetModel *model;
25 25 @property (assign, nonatomic) NSInteger index;
26 26 @property (nonatomic, copy) void (^didSelectPhotoBlock)(BOOL);
27   -@property (nonatomic, assign) TZAssetCellType type;
  27 +@property (nonatomic, assign) CNTZAssetCellType type;
28 28 @property (nonatomic, assign) BOOL allowPickingGif;
29 29 @property (nonatomic, assign) BOOL allowPickingMultipleVideo;
30 30 @property (nonatomic, copy) NSString *representedAssetIdentifier;
... ... @@ -37,21 +37,21 @@ typedef enum : NSUInteger {
37 37 @property (assign, nonatomic) BOOL allowPreview;
38 38 @property (assign, nonatomic) BOOL useCachedImage;
39 39  
40   -@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
41   -@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  40 +@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  41 +@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
42 42 @end
43 43  
44 44  
45   -@class TZAlbumModel;
46   -@interface TZAlbumCell : UITableViewCell
47   -@property (nonatomic, strong) TZAlbumModel *model;
  45 +@class CNTZAlbumModel;
  46 +@interface CNTZAlbumCell : UITableViewCell
  47 +@property (nonatomic, strong) CNTZAlbumModel *model;
48 48 @property (weak, nonatomic) UIButton *selectedCountButton;
49 49  
50   -@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
51   -@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  50 +@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  51 +@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
52 52 @end
53 53  
54 54  
55   -@interface TZAssetCameraCell : UICollectionViewCell
  55 +@interface CNTZAssetCameraCell : UICollectionViewCell
56 56 @property (nonatomic, strong) UIImageView *imageView;
57 57 @end
... ...
CNLiveImagePickerController/Classes/TZAssetCell.m renamed to CNLiveImagePickerController/Classes/CNTZAssetCell.m
1 1 //
2   -// TZAssetCell.m
3   -// TZImagePickerController
  2 +// CNTZAssetCell.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZAssetCell.h"
10   -#import "TZAssetModel.h"
11   -#import "UIView+TZLayout.h"
12   -#import "TZImageManager.h"
13   -#import "TZImagePickerController.h"
14   -#import "TZProgressView.h"
  9 +#import "CNTZAssetCell.h"
  10 +#import "CNTZAssetModel.h"
  11 +#import "UIView+CNTZLayout.h"
  12 +#import "CNTZImageManager.h"
  13 +#import "CNTZImagePickerController.h"
  14 +#import "CNTZProgressView.h"
15 15  
16   -@interface TZAssetCell ()
  16 +@interface CNTZAssetCell ()
17 17 @property (weak, nonatomic) UIImageView *imageView; // The photo / 照片
18 18 @property (weak, nonatomic) UIImageView *selectImageView;
19 19 @property (weak, nonatomic) UILabel *indexLabel;
... ... @@ -22,23 +22,23 @@
22 22 @property (strong, nonatomic) UITapGestureRecognizer *tapGesture;
23 23  
24 24 @property (nonatomic, weak) UIImageView *videoImgView;
25   -@property (nonatomic, strong) TZProgressView *progressView;
  25 +@property (nonatomic, strong) CNTZProgressView *progressView;
26 26 @property (nonatomic, assign) int32_t bigImageRequestID;
27 27 @end
28 28  
29   -@implementation TZAssetCell
  29 +@implementation CNTZAssetCell
30 30  
31   -- (void)setModel:(TZAssetModel *)model {
  31 +- (void)setModel:(CNTZAssetModel *)model {
32 32 _model = model;
33 33 if (iOS8Later) {
34   - self.representedAssetIdentifier = [[TZImageManager manager] getAssetIdentifier:model.asset];
  34 + self.representedAssetIdentifier = [[CNTZImageManager manager] getAssetIdentifier:model.asset];
35 35 }
36 36 if (self.useCachedImage && model.cachedImage) {
37 37 self.imageView.image = model.cachedImage;
38 38 } else {
39 39 self.model.cachedImage = nil;
40 40 __weak typeof(self) weakSelf = self;
41   - int32_t imageRequestID = [[TZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.tz_width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  41 + int32_t imageRequestID = [[CNTZImageManager manager] getPhotoWithAsset:model.asset photoWidth:self.CNTZ_width completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
42 42 // NSLog(@"输出导出参数info = %@",info);
43 43 if (photo) {//lxg: 裂图
44 44 model.isExport = YES;
... ... @@ -53,7 +53,7 @@
53 53 [weakSelf hideProgressView];
54 54 return;
55 55 }
56   - if ([weakSelf.representedAssetIdentifier isEqualToString:[[TZImageManager manager] getAssetIdentifier:model.asset]]) {
  56 + if ([weakSelf.representedAssetIdentifier isEqualToString:[[CNTZImageManager manager] getAssetIdentifier:model.asset]]) {
57 57 weakSelf.imageView.image = photo;
58 58 weakSelf.model.cachedImage = photo;
59 59 } else {
... ... @@ -74,13 +74,13 @@
74 74 }
75 75  
76 76 /** 处理视频 */
77   - if (model.type == TZAssetModelMediaTypeVideo) {
  77 + if (model.type == CNTZAssetModelMediaTypeVideo) {
78 78  
79 79 if (model.isCheckICloudType) {//是否检测来源
80 80 NSLog(@"输出检测过来源");
81 81 }else {
82 82  
83   - [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
  83 + [[CNTZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
84 84 NSLog(@"输出识别后结果 = %@",info);
85 85 NSLog(@"Info:%@",info);
86 86 model.isCheckICloudType = YES;
... ... @@ -151,7 +151,7 @@
151 151  
152 152 self.type = (NSInteger)model.type;
153 153 // 让宽度/高度小于 最小可选照片尺寸 的图片不能选中
154   - if (![[TZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {
  154 + if (![[CNTZImageManager manager] isPhotoSelectableWithAsset:model.asset]) {
155 155 if (_selectImageView.hidden == NO) {
156 156 self.selectPhotoButton.hidden = YES;
157 157 _selectImageView.hidden = YES;
... ... @@ -164,7 +164,7 @@
164 164 [self cancelBigImageRequest];
165 165 }
166 166 if (model.needOscillatoryAnimation) {
167   - [UIView showOscillatoryAnimationWithLayer:self.selectImageView.layer type:TZOscillatoryAnimationToBigger];
  167 + [UIView showOscillatoryAnimationWithLayer:self.selectImageView.layer type:CNTZOscillatoryAnimationToBigger];
168 168 }
169 169 model.needOscillatoryAnimation = NO;
170 170  
... ... @@ -189,7 +189,7 @@
189 189  
190 190 - (void)setShowSelectBtn:(BOOL)showSelectBtn {
191 191 _showSelectBtn = showSelectBtn;
192   - BOOL selectable = [[TZImageManager manager] isPhotoSelectableWithAsset:self.model.asset];
  192 + BOOL selectable = [[CNTZImageManager manager] isPhotoSelectableWithAsset:self.model.asset];
193 193 if (!self.selectPhotoButton.hidden) {
194 194 self.selectPhotoButton.hidden = !showSelectBtn || !selectable;
195 195 }
... ... @@ -198,9 +198,9 @@
198 198 }
199 199 }
200 200  
201   -- (void)setType:(TZAssetCellType)type {
  201 +- (void)setType:(CNTZAssetCellType)type {
202 202 _type = type;
203   - if (type == TZAssetCellTypePhoto || type == TZAssetCellTypeLivePhoto || (type == TZAssetCellTypePhotoGif && !self.allowPickingGif) || self.allowPickingMultipleVideo) {
  203 + if (type == CNTZAssetCellTypePhoto || type == CNTZAssetCellTypeLivePhoto || (type == CNTZAssetCellTypePhotoGif && !self.allowPickingGif) || self.allowPickingMultipleVideo) {
204 204 _selectImageView.hidden = NO;
205 205 _selectPhotoButton.hidden = NO;
206 206 _bottomView.hidden = YES;
... ... @@ -209,17 +209,17 @@
209 209 _selectPhotoButton.hidden = YES;
210 210 }
211 211  
212   - if (type == TZAssetCellTypeVideo) {
  212 + if (type == CNTZAssetCellTypeVideo) {
213 213 self.bottomView.hidden = NO;
214 214 self.timeLength.text = _model.timeLength;
215 215 self.videoImgView.hidden = NO;
216   - _timeLength.tz_left = self.videoImgView.tz_right;
  216 + _timeLength.CNTZ_left = self.videoImgView.CNTZ_right;
217 217 _timeLength.textAlignment = NSTextAlignmentRight;
218   - } else if (type == TZAssetCellTypePhotoGif && self.allowPickingGif) {
  218 + } else if (type == CNTZAssetCellTypePhotoGif && self.allowPickingGif) {
219 219 self.bottomView.hidden = NO;
220 220 self.timeLength.text = @"GIF";
221 221 self.videoImgView.hidden = YES;
222   - _timeLength.tz_left = 5;
  222 + _timeLength.CNTZ_left = 5;
223 223 _timeLength.textAlignment = NSTextAlignmentLeft;
224 224 }
225 225 }
... ... @@ -241,8 +241,8 @@
241 241 }
242 242 self.selectImageView.image = sender.isSelected ? self.photoSelImage : self.photoDefImage;
243 243 if (sender.isSelected) {
244   - if (![TZImagePickerConfig sharedInstance].showSelectedIndex && ![TZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer) {
245   - [UIView showOscillatoryAnimationWithLayer:_selectImageView.layer type:TZOscillatoryAnimationToBigger];
  244 + if (![CNTZImagePickerConfig sharedInstance].showSelectedIndex && ![CNTZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer) {
  245 + [UIView showOscillatoryAnimationWithLayer:_selectImageView.layer type:CNTZOscillatoryAnimationToBigger];
246 246 }
247 247 // 用户选中了该图片,提前获取一下大图
248 248 [self requestBigImage];
... ... @@ -271,7 +271,7 @@
271 271 }
272 272  
273 273 __weak typeof(self) weakSelf = self;
274   - _bigImageRequestID = [[TZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
  274 + _bigImageRequestID = [[CNTZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
275 275 [weakSelf hideProgressView];
276 276 } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
277 277 if (weakSelf.model.isSelected) {
... ... @@ -388,9 +388,9 @@
388 388 return _indexLabel;
389 389 }
390 390  
391   -- (TZProgressView *)progressView {
  391 +- (CNTZProgressView *)progressView {
392 392 if (_progressView == nil) {
393   - _progressView = [[TZProgressView alloc] init];
  393 + _progressView = [[CNTZProgressView alloc] init];
394 394 _progressView.hidden = YES;
395 395 [self addSubview:_progressView];
396 396 }
... ... @@ -401,26 +401,26 @@
401 401 [super layoutSubviews];
402 402 _cannotSelectLayerButton.frame = self.bounds;
403 403 if (self.allowPreview) {
404   - _selectPhotoButton.frame = CGRectMake(self.tz_width - 44, 0, 44, 44);
  404 + _selectPhotoButton.frame = CGRectMake(self.CNTZ_width - 44, 0, 44, 44);
405 405 } else {
406 406 _selectPhotoButton.frame = self.bounds;
407 407 }
408   - _selectImageView.frame = CGRectMake(self.tz_width - 27, 3, 24, 24);
  408 + _selectImageView.frame = CGRectMake(self.CNTZ_width - 27, 3, 24, 24);
409 409 if (_selectImageView.image.size.width <= 27) {
410 410 _selectImageView.contentMode = UIViewContentModeCenter;
411 411 } else {
412 412 _selectImageView.contentMode = UIViewContentModeScaleAspectFit;
413 413 }
414 414 _indexLabel.frame = _selectImageView.frame;
415   - _imageView.frame = CGRectMake(0, 0, self.tz_width, self.tz_height);
  415 + _imageView.frame = CGRectMake(0, 0, self.CNTZ_width, self.CNTZ_height);
416 416  
417 417 static CGFloat progressWH = 20;
418   - CGFloat progressXY = (self.tz_width - progressWH) / 2;
  418 + CGFloat progressXY = (self.CNTZ_width - progressWH) / 2;
419 419 _progressView.frame = CGRectMake(progressXY, progressXY, progressWH, progressWH);
420 420  
421   - _bottomView.frame = CGRectMake(0, self.tz_height - 17, self.tz_width, 17);
  421 + _bottomView.frame = CGRectMake(0, self.CNTZ_height - 17, self.CNTZ_width, 17);
422 422 _videoImgView.frame = CGRectMake(8, 0, 17, 17);
423   - _timeLength.frame = CGRectMake(self.videoImgView.tz_right, 0, self.tz_width - self.videoImgView.tz_right - 5, 17);
  423 + _timeLength.frame = CGRectMake(self.videoImgView.CNTZ_right, 0, self.CNTZ_width - self.videoImgView.CNTZ_right - 5, 17);
424 424  
425 425 self.type = (NSInteger)self.model.type;
426 426 self.showSelectBtn = self.showSelectBtn;
... ... @@ -438,13 +438,13 @@
438 438  
439 439 @end
440 440  
441   -@interface TZAlbumCell ()
  441 +@interface CNTZAlbumCell ()
442 442 @property (weak, nonatomic) UIImageView *posterImageView;
443 443 @property (weak, nonatomic) UILabel *titleLabel;
444 444 @property (weak, nonatomic) UIImageView *enterImageView;
445 445 @end
446 446  
447   -@implementation TZAlbumCell
  447 +@implementation CNTZAlbumCell
448 448  
449 449 - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
450 450 self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
... ... @@ -452,7 +452,7 @@
452 452 return self;
453 453 }
454 454  
455   -- (void)setModel:(TZAlbumModel *)model {
  455 +- (void)setModel:(CNTZAlbumModel *)model {
456 456 _model = model;
457 457  
458 458 NSMutableAttributedString *nameString = [[NSMutableAttributedString alloc] initWithString:model.name attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:[UIColor blackColor]}];
... ... @@ -460,7 +460,7 @@
460 460 [nameString appendAttributedString:countString];
461 461 self.titleLabel.attributedText = nameString;
462 462 __weak typeof(self) weakSelf = self;
463   - [[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {
  463 + [[CNTZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {
464 464 weakSelf.posterImageView.image = postImage;
465 465 }];
466 466 if (model.selectedCount) {
... ... @@ -482,10 +482,10 @@
482 482 /// For fitting iOS6
483 483 - (void)layoutSubviews {
484 484 if (iOS7Later) [super layoutSubviews];
485   - _selectedCountButton.frame = CGRectMake(self.tz_width - 24 - 30, 23, 24, 24);
486   - self.enterImageView.frame = CGRectMake(self.tz_width - 20, 30, 6, 12);
  485 + _selectedCountButton.frame = CGRectMake(self.CNTZ_width - 24 - 30, 23, 24, 24);
  486 + self.enterImageView.frame = CGRectMake(self.CNTZ_width - 20, 30, 6, 12);
487 487 NSInteger titleHeight = ceil(self.titleLabel.font.lineHeight);
488   - self.titleLabel.frame = CGRectMake(80, (self.tz_height - titleHeight) / 2, self.tz_width - 80 - 50, titleHeight);
  488 + self.titleLabel.frame = CGRectMake(80, (self.CNTZ_height - titleHeight) / 2, self.CNTZ_width - 80 - 50, titleHeight);
489 489 self.posterImageView.frame = CGRectMake(0, 0, 70, 70);
490 490  
491 491 if (self.albumCellDidLayoutSubviewsBlock) {
... ... @@ -550,7 +550,7 @@
550 550  
551 551  
552 552  
553   -@implementation TZAssetCameraCell
  553 +@implementation CNTZAssetCameraCell
554 554  
555 555 - (instancetype)initWithFrame:(CGRect)frame {
556 556 self = [super initWithFrame:frame];
... ...
CNLiveImagePickerController/Classes/TZAssetModel.h renamed to CNLiveImagePickerController/Classes/CNTZAssetModel.h
1 1 //
2   -// TZAssetModel.h
3   -// TZImagePickerController
  2 +// CNTZAssetModel.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
... ... @@ -10,19 +10,19 @@
10 10 #import <UIKit/UIKit.h>
11 11  
12 12 typedef enum : NSUInteger {
13   - TZAssetModelMediaTypePhoto = 0,
14   - TZAssetModelMediaTypeLivePhoto,
15   - TZAssetModelMediaTypePhotoGif,
16   - TZAssetModelMediaTypeVideo,
17   - TZAssetModelMediaTypeAudio
18   -} TZAssetModelMediaType;
  13 + CNTZAssetModelMediaTypePhoto = 0,
  14 + CNTZAssetModelMediaTypeLivePhoto,
  15 + CNTZAssetModelMediaTypePhotoGif,
  16 + CNTZAssetModelMediaTypeVideo,
  17 + CNTZAssetModelMediaTypeAudio
  18 +} CNTZAssetModelMediaType;
19 19  
20 20 @class PHAsset;
21   -@interface TZAssetModel : NSObject
  21 +@interface CNTZAssetModel : NSObject
22 22  
23 23 @property (nonatomic, strong) id asset; ///< PHAsset or ALAsset
24 24 @property (nonatomic, assign) BOOL isSelected; ///< The select status of a photo, default is No
25   -@property (nonatomic, assign) TZAssetModelMediaType type; // 类型
  25 +@property (nonatomic, assign) CNTZAssetModelMediaType type; // 类型
26 26 @property (assign, nonatomic) BOOL needOscillatoryAnimation;
27 27 @property (nonatomic, copy) NSString *timeLength;
28 28 @property (strong, nonatomic) UIImage *cachedImage;
... ... @@ -35,14 +35,14 @@ typedef enum : NSUInteger {
35 35  
36 36 /// Init a photo dataModel With a asset
37 37 /// 用一个PHAsset/ALAsset实例,初始化一个照片模型
38   -+ (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type;
39   -+ (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength;
  38 ++ (instancetype)modelWithAsset:(id)asset type:(CNTZAssetModelMediaType)type;
  39 ++ (instancetype)modelWithAsset:(id)asset type:(CNTZAssetModelMediaType)type timeLength:(NSString *)timeLength;
40 40  
41 41 @end
42 42  
43 43  
44 44 @class PHFetchResult;
45   -@interface TZAlbumModel : NSObject
  45 +@interface CNTZAlbumModel : NSObject
46 46  
47 47 @property (nonatomic, strong) NSString *name; ///< The album name
48 48 @property (nonatomic, assign) NSInteger count; ///< Count of photos the album contain
... ...
CNLiveImagePickerController/Classes/TZAssetModel.m renamed to CNLiveImagePickerController/Classes/CNTZAssetModel.m
1 1 //
2   -// TZAssetModel.m
3   -// TZImagePickerController
  2 +// CNTZAssetModel.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZAssetModel.h"
10   -#import "TZImageManager.h"
  9 +#import "CNTZAssetModel.h"
  10 +#import "CNTZImageManager.h"
11 11  
12   -@implementation TZAssetModel
  12 +@implementation CNTZAssetModel
13 13  
14   -+ (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type{
15   - TZAssetModel *model = [[TZAssetModel alloc] init];
  14 ++ (instancetype)modelWithAsset:(id)asset type:(CNTZAssetModelMediaType)type{
  15 + CNTZAssetModel *model = [[CNTZAssetModel alloc] init];
16 16 model.asset = asset;
17 17 model.isSelected = NO;
18 18 model.type = type;
19 19 return model;
20 20 }
21 21  
22   -+ (instancetype)modelWithAsset:(id)asset type:(TZAssetModelMediaType)type timeLength:(NSString *)timeLength {
23   - TZAssetModel *model = [self modelWithAsset:asset type:type];
  22 ++ (instancetype)modelWithAsset:(id)asset type:(CNTZAssetModelMediaType)type timeLength:(NSString *)timeLength {
  23 + CNTZAssetModel *model = [self modelWithAsset:asset type:type];
24 24 model.timeLength = timeLength;
25 25 return model;
26 26 }
... ... @@ -29,13 +29,13 @@
29 29  
30 30  
31 31  
32   -@implementation TZAlbumModel
  32 +@implementation CNTZAlbumModel
33 33  
34 34 - (void)setResult:(id)result needFetchAssets:(BOOL)needFetchAssets {
35 35 _result = result;
36 36 if (needFetchAssets) {
37 37 __weak typeof(self) weakSelf = self;
38   - [[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) {
  38 + [[CNTZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<CNTZAssetModel *> *models) {
39 39 self->_models = models;
40 40 if (self->_selectedModels) {
41 41 [weakSelf checkSelectedModels];
... ... @@ -54,11 +54,11 @@
54 54 - (void)checkSelectedModels {
55 55 self.selectedCount = 0;
56 56 NSMutableArray *selectedAssets = [NSMutableArray array];
57   - for (TZAssetModel *model in _selectedModels) {
  57 + for (CNTZAssetModel *model in _selectedModels) {
58 58 [selectedAssets addObject:model.asset];
59 59 }
60   - for (TZAssetModel *model in _models) {
61   - if ([[TZImageManager manager] isAssetsArray:selectedAssets containAsset:model.asset]) {
  60 + for (CNTZAssetModel *model in _models) {
  61 + if ([[CNTZImageManager manager] isAssetsArray:selectedAssets containAsset:model.asset]) {
62 62 self.selectedCount ++;
63 63 }
64 64 }
... ...
CNLiveImagePickerController/Classes/TZGifPhotoPreviewController.h renamed to CNLiveImagePickerController/Classes/CNTZGifPhotoPreviewController.h
1 1 //
2   -// TZGifPhotoPreviewController.h
3   -// TZImagePickerController
  2 +// CNTZGifPhotoPreviewController.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by ttouch on 2016/12/13.
6 6 // Copyright © 2016年 谭真. All rights reserved.
... ... @@ -8,9 +8,9 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -@class TZAssetModel;
12   -@interface TZGifPhotoPreviewController : UIViewController
  11 +@class CNTZAssetModel;
  12 +@interface CNTZGifPhotoPreviewController : UIViewController
13 13  
14   -@property (nonatomic, strong) TZAssetModel *model;
  14 +@property (nonatomic, strong) CNTZAssetModel *model;
15 15  
16 16 @end
... ...
CNLiveImagePickerController/Classes/TZGifPhotoPreviewController.m renamed to CNLiveImagePickerController/Classes/CNTZGifPhotoPreviewController.m
  1 +
1 2 //
2   -// TZGifPhotoPreviewController.m
3   -// TZImagePickerController
  3 +// CNTZGifPhotoPreviewController.m
  4 +// CNTZImagePickerController
4 5 //
5 6 // Created by ttouch on 2016/12/13.
6 7 // Copyright © 2016年 谭真. All rights reserved.
7 8 //
8 9  
9   -#import "TZGifPhotoPreviewController.h"
10   -#import "TZImagePickerController.h"
11   -#import "TZAssetModel.h"
12   -#import "UIView+TZLayout.h"
13   -#import "TZPhotoPreviewCell.h"
14   -#import "TZImageManager.h"
  10 +#import "CNTZGifPhotoPreviewController.h"
  11 +#import "CNTZImagePickerController.h"
  12 +#import "CNTZAssetModel.h"
  13 +#import "UIView+CNTZLayout.h"
  14 +#import "CNTZPhotoPreviewCell.h"
  15 +#import "CNTZImageManager.h"
15 16  
16 17 #pragma clang diagnostic push
17 18 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
18 19  
19   -@interface TZGifPhotoPreviewController () {
  20 +@interface CNTZGifPhotoPreviewController () {
20 21 UIView *_toolBar;
21 22 UIButton *_doneButton;
22 23 UIProgressView *_progress;
23 24  
24   - TZPhotoPreviewView *_previewView;
  25 + CNTZPhotoPreviewView *_previewView;
25 26  
26 27 UIStatusBarStyle _originStatusBarStyle;
27 28 }
28 29 @end
29 30  
30   -@implementation TZGifPhotoPreviewController
  31 +@implementation CNTZGifPhotoPreviewController
31 32  
32 33 - (void)viewDidLoad {
33 34 [super viewDidLoad];
34 35 self.view.backgroundColor = [UIColor blackColor];
35   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
36   - if (tzImagePickerVc) {
37   - self.navigationItem.title = [NSString stringWithFormat:@"GIF %@",tzImagePickerVc.previewBtnTitleStr];
  36 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  37 + if (CNTZImagePickerVc) {
  38 + self.navigationItem.title = [NSString stringWithFormat:@"GIF %@",CNTZImagePickerVc.previewBtnTitleStr];
38 39 }
39 40 [self configPreviewView];
40 41 [self configBottomToolBar];
... ... @@ -52,7 +53,7 @@
52 53 }
53 54  
54 55 - (void)configPreviewView {
55   - _previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];
  56 + _previewView = [[CNTZPhotoPreviewView alloc] initWithFrame:CGRectZero];
56 57 _previewView.model = self.model;
57 58 __weak typeof(self) weakSelf = self;
58 59 [_previewView setSingleTapGestureBlock:^{
... ... @@ -70,12 +71,12 @@
70 71 _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
71 72 _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];
72 73 [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
73   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
74   - if (tzImagePickerVc) {
75   - [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
76   - [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
  74 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  75 + if (CNTZImagePickerVc) {
  76 + [_doneButton setTitle:CNTZImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
  77 + [_doneButton setTitleColor:CNTZImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
77 78 } else {
78   - [_doneButton setTitle:[NSBundle tz_localizedStringForKey:@"Done"] forState:UIControlStateNormal];
  79 + [_doneButton setTitle:[NSBundle CNTZ_localizedStringForKey:@"Done"] forState:UIControlStateNormal];
79 80 [_doneButton setTitleColor:[UIColor colorWithRed:(83/255.0) green:(179/255.0) blue:(17/255.0) alpha:1.0] forState:UIControlStateNormal];
80 81 }
81 82 [_toolBar addSubview:_doneButton];
... ... @@ -84,15 +85,15 @@
84 85 byteLabel.textColor = [UIColor whiteColor];
85 86 byteLabel.font = [UIFont systemFontOfSize:13];
86 87 byteLabel.frame = CGRectMake(10, 0, 100, 44);
87   - [[TZImageManager manager] getPhotosBytesWithArray:@[_model] completion:^(NSString *totalBytes) {
  88 + [[CNTZImageManager manager] getPhotosBytesWithArray:@[_model] completion:^(NSString *totalBytes) {
88 89 byteLabel.text = totalBytes;
89 90 }];
90 91 [_toolBar addSubview:byteLabel];
91 92  
92 93 [self.view addSubview:_toolBar];
93 94  
94   - if (tzImagePickerVc.gifPreviewPageUIConfigBlock) {
95   - tzImagePickerVc.gifPreviewPageUIConfigBlock(_toolBar, _doneButton);
  95 + if (CNTZImagePickerVc.gifPreviewPageUIConfigBlock) {
  96 + CNTZImagePickerVc.gifPreviewPageUIConfigBlock(_toolBar, _doneButton);
96 97 }
97 98 }
98 99  
... ... @@ -103,13 +104,13 @@
103 104  
104 105 _previewView.frame = self.view.bounds;
105 106 _previewView.scrollView.frame = self.view.bounds;
106   - CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 44 + (83 - 49) : 44;
107   - _toolBar.frame = CGRectMake(0, self.view.tz_height - toolBarHeight, self.view.tz_width, toolBarHeight);
108   - _doneButton.frame = CGRectMake(self.view.tz_width - 44 - 12, 0, 44, 44);
  107 + CGFloat toolBarHeight = [CNTZCommonTools CNTZ_isIPhoneX] ? 44 + (83 - 49) : 44;
  108 + _toolBar.frame = CGRectMake(0, self.view.CNTZ_height - toolBarHeight, self.view.CNTZ_width, toolBarHeight);
  109 + _doneButton.frame = CGRectMake(self.view.CNTZ_width - 44 - 12, 0, 44, 44);
109 110  
110   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
111   - if (tzImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock) {
112   - tzImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock(_toolBar, _doneButton);
  111 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  112 + if (CNTZImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock) {
  113 + CNTZImagePickerVc.gifPreviewPageDidLayoutSubviewsBlock(_toolBar, _doneButton);
113 114 }
114 115 }
115 116  
... ... @@ -118,11 +119,11 @@
118 119 - (void)signleTapAction {
119 120 _toolBar.hidden = !_toolBar.isHidden;
120 121 [self.navigationController setNavigationBarHidden:_toolBar.isHidden];
121   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  122 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
122 123 if (iOS7Later) {
123 124 if (_toolBar.isHidden) {
124 125 [UIApplication sharedApplication].statusBarHidden = YES;
125   - } else if (tzImagePickerVc.needShowStatusBar) {
  126 + } else if (CNTZImagePickerVc.needShowStatusBar) {
126 127 [UIApplication sharedApplication].statusBarHidden = NO;
127 128 }
128 129 }
... ... @@ -132,7 +133,7 @@
132 133 #pragma mark - TODO: 导出
133 134  
134 135 if (self.navigationController) {
135   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  136 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
136 137 if (imagePickerVc.autoDismiss) {
137 138 [self.navigationController dismissViewControllerAnimated:YES completion:^{
138 139 [self callDelegateMethod];
... ... @@ -148,7 +149,7 @@
148 149 }
149 150  
150 151 - (void)callDelegateMethod {
151   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  152 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
152 153 UIImage *animatedImage = _previewView.imageView.image;
153 154 if ([imagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingGifImage:sourceAssets:)]) {
154 155 [imagePickerVc.pickerDelegate imagePickerController:imagePickerVc didFinishPickingGifImage:animatedImage sourceAssets:_model.asset];
... ...
CNLiveImagePickerController/Classes/TZImageCropManager.h renamed to CNLiveImagePickerController/Classes/CNTZImageCropManager.h
1 1 //
2   -// TZImageCropManager.h
3   -// TZImagePickerController
  2 +// CNTZImageCropManager.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 2016/12/5.
6 6 // Copyright © 2016年 谭真. All rights reserved.
... ... @@ -9,7 +9,7 @@
9 9 #import <Foundation/Foundation.h>
10 10 #import <UIKit/UIKit.h>
11 11  
12   -@interface TZImageCropManager : NSObject
  12 +@interface CNTZImageCropManager : NSObject
13 13  
14 14 /// 裁剪框背景的处理
15 15 + (void)overlayClippingWithView:(UIView *)view cropRect:(CGRect)cropRect containerView:(UIView *)containerView needCircleCrop:(BOOL)needCircleCrop;
... ... @@ -32,8 +32,8 @@
32 32  
33 33 /// 该分类的代码来自SDWebImage:https://github.com/rs/SDWebImage
34 34 /// 为了防止冲突,我将分类名字和方法名字做了修改
35   -@interface UIImage (TZGif)
  35 +@interface UIImage (CNTZGif)
36 36  
37   -+ (UIImage *)sd_tz_animatedGIFWithData:(NSData *)data;
  37 ++ (UIImage *)sd_CNTZ_animatedGIFWithData:(NSData *)data;
38 38  
39 39 @end
... ...
CNLiveImagePickerController/Classes/TZImageCropManager.m renamed to CNLiveImagePickerController/Classes/CNTZImageCropManager.m
1 1 //
2   -// TZImageCropManager.m
3   -// TZImagePickerController
  2 +// CNTZImageCropManager.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 2016/12/5.
6 6 // Copyright © 2016年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZImageCropManager.h"
10   -#import "UIView+TZLayout.h"
  9 +#import "CNTZImageCropManager.h"
  10 +#import "UIView+CNTZLayout.h"
11 11 #import <ImageIO/ImageIO.h>
12   -#import "TZImageManager.h"
13   -#import "TZImagePickerController.h"
  12 +#import "CNTZImageManager.h"
  13 +#import "CNTZImagePickerController.h"
14 14  
15   -@implementation TZImageCropManager
  15 +@implementation CNTZImageCropManager
16 16  
17 17 /// 裁剪框背景的处理
18 18 + (void)overlayClippingWithView:(UIView *)view cropRect:(CGRect)cropRect containerView:(UIView *)containerView needCircleCrop:(BOOL)needCircleCrop {
... ... @@ -36,7 +36,7 @@
36 36 // 平移的处理
37 37 CGRect imageViewRect = [imageView convertRect:imageView.bounds toView:containerView];
38 38 CGPoint point = CGPointMake(imageViewRect.origin.x + imageViewRect.size.width / 2, imageViewRect.origin.y + imageViewRect.size.height / 2);
39   - CGFloat xMargin = containerView.tz_width - CGRectGetMaxX(rect) - rect.origin.x;
  39 + CGFloat xMargin = containerView.CNTZ_width - CGRectGetMaxX(rect) - rect.origin.x;
40 40 CGPoint zeroPoint = CGPointMake((CGRectGetWidth(containerView.frame) - xMargin) / 2, containerView.center.y);
41 41 CGPoint translation = CGPointMake(point.x - zeroPoint.x, point.y - zeroPoint.y);
42 42 transform = CGAffineTransformTranslate(transform, translation.x, translation.y);
... ... @@ -50,7 +50,7 @@
50 50 cropSize:rect.size
51 51 imageViewSize:imageView.frame.size];
52 52 UIImage *cropedImage = [UIImage imageWithCGImage:imageRef];
53   - cropedImage = [[TZImageManager manager] fixOrientation:cropedImage];
  53 + cropedImage = [[CNTZImageManager manager] fixOrientation:cropedImage];
54 54 CGImageRelease(imageRef);
55 55 return cropedImage;
56 56 }
... ... @@ -115,9 +115,9 @@
115 115 @end
116 116  
117 117  
118   -@implementation UIImage (TZGif)
  118 +@implementation UIImage (CNTZGif)
119 119  
120   -+ (UIImage *)sd_tz_animatedGIFWithData:(NSData *)data {
  120 ++ (UIImage *)sd_CNTZ_animatedGIFWithData:(NSData *)data {
121 121 if (!data) {
122 122 return nil;
123 123 }
... ... @@ -133,7 +133,7 @@
133 133 }
134 134 else {
135 135 // images数组过大时内存会飙升,在这里限制下最大count
136   - NSInteger maxCount = [TZImagePickerConfig sharedInstance].gifPreviewMaxImagesCount ?: 200;
  136 + NSInteger maxCount = [CNTZImagePickerConfig sharedInstance].gifPreviewMaxImagesCount ?: 200;
137 137 NSInteger interval = MAX((count + maxCount / 2) / maxCount, 1);
138 138  
139 139 NSMutableArray *images = [NSMutableArray array];
... ...
CNLiveImagePickerController/Classes/TZImageManager.h renamed to CNLiveImagePickerController/Classes/CNTZImageManager.h
1 1 //
2   -// TZImageManager.h
3   -// TZImagePickerController
  2 +// CNTZImageManager.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 16/1/4.
6 6 // Copyright © 2016年 谭真. All rights reserved.
... ... @@ -10,18 +10,18 @@
10 10 #import <UIKit/UIKit.h>
11 11 #import <AVFoundation/AVFoundation.h>
12 12 #import <Photos/Photos.h>
13   -#import "TZAssetModel.h"
  13 +#import "CNTZAssetModel.h"
14 14  
15   -@class TZAlbumModel,TZAssetModel;
16   -@protocol TZImagePickerControllerDelegate;
17   -@interface TZImageManager : NSObject
  15 +@class CNTZAlbumModel,CNTZAssetModel;
  16 +@protocol CNTZImagePickerControllerDelegate;
  17 +@interface CNTZImageManager : NSObject
18 18  
19 19 @property (nonatomic, strong) PHCachingImageManager *cachingImageManager;
20 20  
21 21 + (instancetype)manager NS_SWIFT_NAME(default());
22 22 + (void)deallocManager;
23 23  
24   -@property (weak, nonatomic) id<TZImagePickerControllerDelegate> pickerDelegate;
  24 +@property (weak, nonatomic) id<CNTZImagePickerControllerDelegate> pickerDelegate;
25 25  
26 26 #pragma mark - 添加: 原有逻辑-会话id(LXG)
27 27 //zl__会话Id用于视频导出路径
... ... @@ -34,8 +34,8 @@
34 34 /// The pixel width of output image, Default is 828px / 导出图片的宽度,默认828像素宽
35 35 @property (nonatomic, assign) CGFloat photoWidth;
36 36  
37   -/// Default is 4, Use in photos collectionView in TZPhotoPickerController
38   -/// 默认4列, TZPhotoPickerController中的照片collectionView
  37 +/// Default is 4, Use in photos collectionView in CNTZPhotoPickerController
  38 +/// 默认4列, CNTZPhotoPickerController中的照片collectionView
39 39 @property (nonatomic, assign) NSInteger columnNumber;
40 40  
41 41 /// Sort photos ascending by modificationDate,Default is YES
... ... @@ -54,16 +54,16 @@
54 54 - (void)requestAuthorizationWithCompletion:(void (^)(void))completion;
55 55  
56 56 /// Get Album 获得相册/相册数组
57   -- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion;
58   -- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *models))completion;
  57 +- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(CNTZAlbumModel *model))completion;
  58 +- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<CNTZAlbumModel *> *models))completion;
59 59  
60 60 /// Get Assets 获得Asset数组
61   -- (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<TZAssetModel *> *models))completion;
62   -- (void)getAssetsFromFetchResult:(id)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAssetModel *> *models))completion;
63   -- (void)getAssetFromFetchResult:(id)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAssetModel *model))completion;
  61 +- (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<CNTZAssetModel *> *models))completion;
  62 +- (void)getAssetsFromFetchResult:(id)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<CNTZAssetModel *> *models))completion;
  63 +- (void)getAssetFromFetchResult:(id)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(CNTZAssetModel *model))completion;
64 64  
65 65 /// Get photo 获得照片
66   -- (void)getPostImageWithAlbumModel:(TZAlbumModel *)model completion:(void (^)(UIImage *postImage))completion;
  66 +- (void)getPostImageWithAlbumModel:(CNTZAlbumModel *)model completion:(void (^)(UIImage *postImage))completion;
67 67  
68 68 - (int32_t)getPhotoWithAsset:(id)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;
69 69 - (int32_t)getPhotoWithAsset:(id)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion;
... ... @@ -114,7 +114,7 @@
114 114 - (UIImage *)fixOrientation:(UIImage *)aImage;
115 115  
116 116 /// 获取asset的资源类型
117   -- (TZAssetModelMediaType)getAssetType:(id)asset;
  117 +- (CNTZAssetModelMediaType)getAssetType:(id)asset;
118 118 /// 缩放图片至新尺寸
119 119 - (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)size;
120 120  
... ... @@ -123,6 +123,6 @@
123 123  
124 124 @end
125 125  
126   -//@interface TZSortDescriptor : NSSortDescriptor
  126 +//@interface CNTZSortDescriptor : NSSortDescriptor
127 127 //
128 128 //@end
... ...
CNLiveImagePickerController/Classes/TZImageManager.m renamed to CNLiveImagePickerController/Classes/CNTZImageManager.m
1 1 //
2   -// TZImageManager.m
3   -// TZImagePickerController
  2 +// CNTZImageManager.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 16/1/4.
6 6 // Copyright © 2016年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZImageManager.h"
  9 +#import "CNTZImageManager.h"
10 10 #import <AssetsLibrary/AssetsLibrary.h>
11   -#import "TZAssetModel.h"
12   -#import "TZImagePickerController.h"
  11 +#import "CNTZAssetModel.h"
  12 +#import "CNTZImagePickerController.h"
13 13 #import <CNLiveBusinessTools/CNLiveBusinessTools.h>
14 14 #import <CNLiveUserManagement/CNUserInfoModel.h>
15 15 #import <CNLiveUserManagement/CNUserInfoManager.h>
16 16  
17   -@interface TZImageManager ()
  17 +@interface CNTZImageManager ()
18 18 #pragma clang diagnostic push
19 19 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
20 20 @property (nonatomic, strong) ALAssetsLibrary *assetLibrary;
21 21 @end
22 22  
23   -@implementation TZImageManager
  23 +@implementation CNTZImageManager
24 24  
25 25 CGSize AssetGridThumbnailSize;
26   -CGFloat TZScreenWidth;
27   -CGFloat TZScreenScale;
  26 +CGFloat CNTZScreenWidth;
  27 +CGFloat CNTZScreenScale;
28 28  
29   -static TZImageManager *manager;
  29 +static CNTZImageManager *manager;
30 30 static dispatch_once_t onceToken;
31 31  
32 32 + (instancetype)manager {
... ... @@ -37,7 +37,7 @@ static dispatch_once_t onceToken;
37 37 // manager.cachingImageManager.allowsCachingHighQualityImages = YES;
38 38 }
39 39  
40   - [manager configTZScreenWidth];
  40 + [manager configCNTZScreenWidth];
41 41 });
42 42 return manager;
43 43 }
... ... @@ -49,24 +49,24 @@ static dispatch_once_t onceToken;
49 49  
50 50 - (void)setPhotoWidth:(CGFloat)photoWidth {
51 51 _photoWidth = photoWidth;
52   - TZScreenWidth = photoWidth / 2;
  52 + CNTZScreenWidth = photoWidth / 2;
53 53 }
54 54  
55 55 - (void)setColumnNumber:(NSInteger)columnNumber {
56   - [self configTZScreenWidth];
  56 + [self configCNTZScreenWidth];
57 57  
58 58 _columnNumber = columnNumber;
59 59 CGFloat margin = 4;
60   - CGFloat itemWH = (TZScreenWidth - 2 * margin - 4) / columnNumber - margin;
61   - AssetGridThumbnailSize = CGSizeMake(itemWH * TZScreenScale, itemWH * TZScreenScale);
  60 + CGFloat itemWH = (CNTZScreenWidth - 2 * margin - 4) / columnNumber - margin;
  61 + AssetGridThumbnailSize = CGSizeMake(itemWH * CNTZScreenScale, itemWH * CNTZScreenScale);
62 62 }
63 63  
64   -- (void)configTZScreenWidth {
65   - TZScreenWidth = [UIScreen mainScreen].bounds.size.width;
  64 +- (void)configCNTZScreenWidth {
  65 + CNTZScreenWidth = [UIScreen mainScreen].bounds.size.width;
66 66 // 测试发现,如果scale在plus真机上取到3.0,内存会增大特别多。故这里写死成2.0
67   - TZScreenScale = 2.0;
68   - if (TZScreenWidth > 700) {
69   - TZScreenScale = 1.5;
  67 + CNTZScreenScale = 2.0;
  68 + if (CNTZScreenWidth > 700) {
  69 + CNTZScreenScale = 1.5;
70 70 }
71 71 }
72 72  
... ... @@ -124,8 +124,8 @@ static dispatch_once_t onceToken;
124 124 #pragma mark - Get Album
125 125  
126 126 /// Get Album 获得相册/相册数组
127   -- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion {
128   - __block TZAlbumModel *model;
  127 +- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(CNTZAlbumModel *model))completion {
  128 + __block CNTZAlbumModel *model;
129 129 if (iOS8Later) {
130 130 PHFetchOptions *option = [[PHFetchOptions alloc] init];
131 131 if (!allowPickingVideo) option.predicate = [NSPredicate predicateWithFormat:@"mediaType == %ld", PHAssetMediaTypeImage];
... ... @@ -162,7 +162,7 @@ static dispatch_once_t onceToken;
162 162 }
163 163 }
164 164  
165   -- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *))completion{
  165 +- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<CNTZAlbumModel *> *))completion{
166 166 NSMutableArray *albumArr = [NSMutableArray array];
167 167 if (iOS8Later) {
168 168 PHFetchOptions *option = [[PHFetchOptions alloc] init];
... ... @@ -242,17 +242,17 @@ static dispatch_once_t onceToken;
242 242 #pragma mark - Get Assets
243 243  
244 244 /// Get Assets 获得照片数组
245   -- (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<TZAssetModel *> *))completion {
246   - TZImagePickerConfig *config = [TZImagePickerConfig sharedInstance];
  245 +- (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<CNTZAssetModel *> *))completion {
  246 + CNTZImagePickerConfig *config = [CNTZImagePickerConfig sharedInstance];
247 247 return [self getAssetsFromFetchResult:result allowPickingVideo:config.allowPickingVideo allowPickingImage:config.allowPickingImage completion:completion];
248 248 }
249 249  
250   -- (void)getAssetsFromFetchResult:(id)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAssetModel *> *))completion {
  250 +- (void)getAssetsFromFetchResult:(id)result allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<CNTZAssetModel *> *))completion {
251 251 NSMutableArray *photoArr = [NSMutableArray array];
252 252 if ([result isKindOfClass:[PHFetchResult class]]) {
253 253 PHFetchResult *fetchResult = (PHFetchResult *)result;
254 254 [fetchResult enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
255   - TZAssetModel *model = [self assetModelWithAsset:obj allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
  255 + CNTZAssetModel *model = [self assetModelWithAsset:obj allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
256 256 if (model) {
257 257 [photoArr addObject:model];
258 258 }
... ... @@ -271,7 +271,7 @@ static dispatch_once_t onceToken;
271 271 if (result == nil) {
272 272 if (completion) completion(photoArr);
273 273 }
274   - TZAssetModel *model = [self assetModelWithAsset:result allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
  274 + CNTZAssetModel *model = [self assetModelWithAsset:result allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
275 275 if (model) {
276 276 [photoArr addObject:model];
277 277 }
... ... @@ -290,7 +290,7 @@ static dispatch_once_t onceToken;
290 290  
291 291 /// Get asset at index 获得下标为index的单个照片
292 292 /// if index beyond bounds, return nil in callback 如果索引越界, 在回调中返回 nil
293   -- (void)getAssetFromFetchResult:(id)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAssetModel *))completion {
  293 +- (void)getAssetFromFetchResult:(id)result atIndex:(NSInteger)index allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(CNTZAssetModel *))completion {
294 294 if ([result isKindOfClass:[PHFetchResult class]]) {
295 295 PHFetchResult *fetchResult = (PHFetchResult *)result;
296 296 PHAsset *asset;
... ... @@ -301,7 +301,7 @@ static dispatch_once_t onceToken;
301 301 if (completion) completion(nil);
302 302 return;
303 303 }
304   - TZAssetModel *model = [self assetModelWithAsset:asset allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
  304 + CNTZAssetModel *model = [self assetModelWithAsset:asset allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
305 305 if (completion) completion(model);
306 306 } else if ([result isKindOfClass:[ALAssetsGroup class]]) {
307 307 ALAssetsGroup *group = (ALAssetsGroup *)result;
... ... @@ -316,7 +316,7 @@ static dispatch_once_t onceToken;
316 316 @try {
317 317 [group enumerateAssetsAtIndexes:indexSet options:NSEnumerationConcurrent usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
318 318 if (!result) return;
319   - TZAssetModel *model = [self assetModelWithAsset:result allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
  319 + CNTZAssetModel *model = [self assetModelWithAsset:result allowPickingVideo:allowPickingVideo allowPickingImage:allowPickingImage];
320 320 if (completion) completion(model);
321 321 }];
322 322 }
... ... @@ -326,19 +326,19 @@ static dispatch_once_t onceToken;
326 326 }
327 327 }
328 328  
329   -- (TZAssetModel *)assetModelWithAsset:(id)asset allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage {
  329 +- (CNTZAssetModel *)assetModelWithAsset:(id)asset allowPickingVideo:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage {
330 330 BOOL canSelect = YES;
331 331 if ([self.pickerDelegate respondsToSelector:@selector(isAssetCanSelect:)]) {
332 332 canSelect = [self.pickerDelegate isAssetCanSelect:asset];
333 333 }
334 334 if (!canSelect) return nil;
335 335  
336   - TZAssetModel *model;
337   - TZAssetModelMediaType type = [self getAssetType:asset];
  336 + CNTZAssetModel *model;
  337 + CNTZAssetModelMediaType type = [self getAssetType:asset];
338 338 if ([asset isKindOfClass:[PHAsset class]]) {
339   - if (!allowPickingVideo && type == TZAssetModelMediaTypeVideo) return nil;
340   - if (!allowPickingImage && type == TZAssetModelMediaTypePhoto) return nil;
341   - if (!allowPickingImage && type == TZAssetModelMediaTypePhotoGif) return nil;
  339 + if (!allowPickingVideo && type == CNTZAssetModelMediaTypeVideo) return nil;
  340 + if (!allowPickingImage && type == CNTZAssetModelMediaTypePhoto) return nil;
  341 + if (!allowPickingImage && type == CNTZAssetModelMediaTypePhotoGif) return nil;
342 342  
343 343 PHAsset *phAsset = (PHAsset *)asset;
344 344 if (self.hideWhenCanNotSelect) {
... ... @@ -347,20 +347,20 @@ static dispatch_once_t onceToken;
347 347 return nil;
348 348 }
349 349 }
350   - NSString *timeLength = type == TZAssetModelMediaTypeVideo ? [NSString stringWithFormat:@"%0.0f",phAsset.duration] : @"";
  350 + NSString *timeLength = type == CNTZAssetModelMediaTypeVideo ? [NSString stringWithFormat:@"%0.0f",phAsset.duration] : @"";
351 351 timeLength = [self getNewTimeFromDurationSecond:timeLength.integerValue];
352   - model = [TZAssetModel modelWithAsset:asset type:type timeLength:timeLength];
  352 + model = [CNTZAssetModel modelWithAsset:asset type:type timeLength:timeLength];
353 353 } else {
354 354 if (!allowPickingVideo){
355   - model = [TZAssetModel modelWithAsset:asset type:type];
  355 + model = [CNTZAssetModel modelWithAsset:asset type:type];
356 356 return model;
357 357 }
358 358 /// Allow picking video
359   - if (type == TZAssetModelMediaTypeVideo) {
  359 + if (type == CNTZAssetModelMediaTypeVideo) {
360 360 NSTimeInterval duration = [[asset valueForProperty:ALAssetPropertyDuration] doubleValue];
361 361 NSString *timeLength = [NSString stringWithFormat:@"%0.0f",duration];
362 362 timeLength = [self getNewTimeFromDurationSecond:timeLength.integerValue];
363   - model = [TZAssetModel modelWithAsset:asset type:type timeLength:timeLength];
  363 + model = [CNTZAssetModel modelWithAsset:asset type:type timeLength:timeLength];
364 364 } else {
365 365 if (self.hideWhenCanNotSelect) {
366 366 // 过滤掉尺寸不满足要求的图片
... ... @@ -368,30 +368,30 @@ static dispatch_once_t onceToken;
368 368 return nil;
369 369 }
370 370 }
371   - model = [TZAssetModel modelWithAsset:asset type:type];
  371 + model = [CNTZAssetModel modelWithAsset:asset type:type];
372 372 }
373 373 }
374 374 return model;
375 375 }
376 376  
377   -- (TZAssetModelMediaType)getAssetType:(id)asset {
378   - TZAssetModelMediaType type = TZAssetModelMediaTypePhoto;
  377 +- (CNTZAssetModelMediaType)getAssetType:(id)asset {
  378 + CNTZAssetModelMediaType type = CNTZAssetModelMediaTypePhoto;
379 379 if ([asset isKindOfClass:[PHAsset class]]) {
380 380 PHAsset *phAsset = (PHAsset *)asset;
381   - if (phAsset.mediaType == PHAssetMediaTypeVideo) type = TZAssetModelMediaTypeVideo;
382   - else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = TZAssetModelMediaTypeAudio;
  381 + if (phAsset.mediaType == PHAssetMediaTypeVideo) type = CNTZAssetModelMediaTypeVideo;
  382 + else if (phAsset.mediaType == PHAssetMediaTypeAudio) type = CNTZAssetModelMediaTypeAudio;
383 383 else if (phAsset.mediaType == PHAssetMediaTypeImage) {
384 384 if (@available(iOS 9.1, *)) {
385   - // if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto;
  385 + // if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = CNTZAssetModelMediaTypeLivePhoto;
386 386 }
387 387 // Gif
388 388 if ([[phAsset valueForKey:@"filename"] hasSuffix:@"GIF"]) {
389   - type = TZAssetModelMediaTypePhotoGif;
  389 + type = CNTZAssetModelMediaTypePhotoGif;
390 390 }
391 391 }
392 392 } else {
393 393 if ([[asset valueForProperty:ALAssetPropertyType] isEqualToString:ALAssetTypeVideo]) {
394   - type = TZAssetModelMediaTypeVideo;
  394 + type = CNTZAssetModelMediaTypeVideo;
395 395 }
396 396 }
397 397 return type;
... ... @@ -424,16 +424,16 @@ static dispatch_once_t onceToken;
424 424 __block NSInteger dataLength = 0;
425 425 __block NSInteger assetCount = 0;
426 426 for (NSInteger i = 0; i < photos.count; i++) {
427   - TZAssetModel *model = photos[i];
  427 + CNTZAssetModel *model = photos[i];
428 428 if ([model.asset isKindOfClass:[PHAsset class]]) {
429 429 PHImageRequestOptions *options = [[PHImageRequestOptions alloc] init];
430 430 options.resizeMode = PHImageRequestOptionsResizeModeFast;
431 431 options.networkAccessAllowed = YES;
432   - if (model.type == TZAssetModelMediaTypePhotoGif) {
  432 + if (model.type == CNTZAssetModelMediaTypePhotoGif) {
433 433 options.version = PHImageRequestOptionsVersionOriginal;
434 434 }
435 435 [[PHImageManager defaultManager] requestImageDataForAsset:model.asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
436   - if (model.type != TZAssetModelMediaTypeVideo) dataLength += imageData.length;
  436 + if (model.type != CNTZAssetModelMediaTypeVideo) dataLength += imageData.length;
437 437 assetCount ++;
438 438 if (assetCount >= photos.count) {
439 439 NSString *bytes = [self getBytesFromDataLength:dataLength];
... ... @@ -442,7 +442,7 @@ static dispatch_once_t onceToken;
442 442 }];
443 443 } else if ([model.asset isKindOfClass:[ALAsset class]]) {
444 444 ALAssetRepresentation *representation = [model.asset defaultRepresentation];
445   - if (model.type != TZAssetModelMediaTypeVideo) dataLength += (NSInteger)representation.size;
  445 + if (model.type != CNTZAssetModelMediaTypeVideo) dataLength += (NSInteger)representation.size;
446 446 if (i >= photos.count - 1) {
447 447 NSString *bytes = [self getBytesFromDataLength:dataLength];
448 448 if (completion) completion(bytes);
... ... @@ -467,7 +467,7 @@ static dispatch_once_t onceToken;
467 467  
468 468 /// Get photo 获得照片本身
469 469 - (int32_t)getPhotoWithAsset:(id)asset completion:(void (^)(UIImage *, NSDictionary *, BOOL isDegraded))completion {
470   - CGFloat fullScreenWidth = TZScreenWidth;
  470 + CGFloat fullScreenWidth = CNTZScreenWidth;
471 471 if (fullScreenWidth > _photoPreviewMaxWidth) {
472 472 fullScreenWidth = _photoPreviewMaxWidth;
473 473 }
... ... @@ -479,7 +479,7 @@ static dispatch_once_t onceToken;
479 479 }
480 480  
481 481 - (int32_t)getPhotoWithAsset:(id)asset completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed {
482   - CGFloat fullScreenWidth = TZScreenWidth;
  482 + CGFloat fullScreenWidth = CNTZScreenWidth;
483 483 if (fullScreenWidth > _photoPreviewMaxWidth) {
484 484 fullScreenWidth = _photoPreviewMaxWidth;
485 485 }
... ... @@ -519,12 +519,12 @@ static dispatch_once_t onceToken;
519 519 - (int32_t)getPhotoWithAsset:(id)asset photoWidth:(CGFloat)photoWidth completion:(void (^)(UIImage *photo,NSDictionary *info,BOOL isDegraded))completion progressHandler:(void (^)(double progress, NSError *error, BOOL *stop, NSDictionary *info))progressHandler networkAccessAllowed:(BOOL)networkAccessAllowed {
520 520 if ([asset isKindOfClass:[PHAsset class]]) {
521 521 CGSize imageSize;
522   - if (photoWidth < TZScreenWidth && photoWidth < _photoPreviewMaxWidth) {
  522 + if (photoWidth < CNTZScreenWidth && photoWidth < _photoPreviewMaxWidth) {
523 523 imageSize = AssetGridThumbnailSize;
524 524 } else {
525 525 PHAsset *phAsset = (PHAsset *)asset;
526 526 CGFloat aspectRatio = phAsset.pixelWidth / (CGFloat)phAsset.pixelHeight;
527   - CGFloat pixelWidth = photoWidth * TZScreenScale * 1.5;
  527 + CGFloat pixelWidth = photoWidth * CNTZScreenScale * 1.5;
528 528 // 超宽图片
529 529 if (aspectRatio > 1.8) {
530 530 pixelWidth = pixelWidth * aspectRatio;
... ... @@ -567,7 +567,7 @@ static dispatch_once_t onceToken;
567 567 options.resizeMode = PHImageRequestOptionsResizeModeFast;
568 568 [[PHImageManager defaultManager] requestImageDataForAsset:asset options:options resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
569 569 UIImage *resultImage = [UIImage imageWithData:imageData scale:0.1];
570   - if (![TZImagePickerConfig sharedInstance].notScaleImage) {
  570 + if (![CNTZImagePickerConfig sharedInstance].notScaleImage) {
571 571 resultImage = [self scaleImage:resultImage toSize:imageSize];
572 572 }
573 573 if (!resultImage) {
... ... @@ -587,7 +587,7 @@ static dispatch_once_t onceToken;
587 587 dispatch_async(dispatch_get_main_queue(), ^{
588 588 if (completion) completion(thumbnailImage,nil,YES);
589 589  
590   - if (photoWidth == TZScreenWidth || photoWidth == self->_photoPreviewMaxWidth) {
  590 + if (photoWidth == CNTZScreenWidth || photoWidth == self->_photoPreviewMaxWidth) {
591 591 dispatch_async(dispatch_get_global_queue(0,0), ^{
592 592 ALAssetRepresentation *assetRep = [alAsset defaultRepresentation];
593 593 CGImageRef fullScrennImageRef = [assetRep fullScreenImage];
... ... @@ -605,13 +605,13 @@ static dispatch_once_t onceToken;
605 605 }
606 606  
607 607 /// Get postImage / 获取封面图
608   -- (void)getPostImageWithAlbumModel:(TZAlbumModel *)model completion:(void (^)(UIImage *))completion {
  608 +- (void)getPostImageWithAlbumModel:(CNTZAlbumModel *)model completion:(void (^)(UIImage *))completion {
609 609 if (iOS8Later) {
610 610 id asset = [model.result lastObject];
611 611 if (!self.sortAscendingByModificationDate) {
612 612 asset = [model.result firstObject];
613 613 }
614   - [[TZImageManager manager] getPhotoWithAsset:asset photoWidth:80 completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  614 + [[CNTZImageManager manager] getPhotoWithAsset:asset photoWidth:80 completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
615 615 if (photo) {//lxg: 裂图
616 616 model.isExport = YES;
617 617 }else{
... ... @@ -924,7 +924,7 @@ static dispatch_once_t onceToken;
924 924 [[NSFileManager defaultManager] createDirectoryAtPath:[NSHomeDirectory() stringByAppendingFormat:@"/tmp"] withIntermediateDirectories:YES attributes:nil error:nil];
925 925 }
926 926  
927   - if ([TZImagePickerConfig sharedInstance].needFixComposition) {
  927 + if ([CNTZImagePickerConfig sharedInstance].needFixComposition) {
928 928 AVMutableVideoComposition *videoComposition = [self fixedCompositionWithAsset:videoAsset];
929 929 if (videoComposition.renderSize.width) {
930 930 // 修正视频转向
... ... @@ -1049,8 +1049,8 @@ static dispatch_once_t onceToken;
1049 1049  
1050 1050 #pragma mark - Private Method
1051 1051  
1052   -- (TZAlbumModel *)modelWithResult:(id)result name:(NSString *)name isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets {
1053   - TZAlbumModel *model = [[TZAlbumModel alloc] init];
  1052 +- (CNTZAlbumModel *)modelWithResult:(id)result name:(NSString *)name isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets {
  1053 + CNTZAlbumModel *model = [[CNTZAlbumModel alloc] init];
1054 1054 [model setResult:result needFetchAssets:needFetchAssets];
1055 1055 model.name = name;
1056 1056 model.isCameraRoll = isCameraRoll;
... ... @@ -1259,10 +1259,10 @@ static dispatch_once_t onceToken;
1259 1259 @end
1260 1260  
1261 1261  
1262   -//@implementation TZSortDescriptor
  1262 +//@implementation CNTZSortDescriptor
1263 1263 //
1264 1264 //- (id)reversedSortDescriptor {
1265   -// return [NSNumber numberWithBool:![TZImageManager manager].sortAscendingByModificationDate];
  1265 +// return [NSNumber numberWithBool:![CNTZImageManager manager].sortAscendingByModificationDate];
1266 1266 //}
1267 1267 //
1268 1268 //@end
... ...
CNLiveImagePickerController/Classes/TZImagePickerController.bundle/MMVideoPreviewPlay@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/MMVideoPreviewPlay@2x.png

3.56 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/MMVideoPreviewPlayHL@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/MMVideoPreviewPlayHL@2x.png

3.56 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/Root.plist renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/Root.plist
CNLiveImagePickerController/Classes/TZImagePickerController.bundle/VideoSendIcon@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/VideoSendIcon@2x.png

223 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/en.lproj/Localizable.strings renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/en.lproj/Localizable.strings
1 1 Binary files a/CNLiveImagePickerController/Classes/TZImagePickerController.bundle/en.lproj/Localizable.strings and b/CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/en.lproj/Localizable.strings differ
... ...
CNLiveImagePickerController/Classes/TZImagePickerController.bundle/fb_quxiao@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/fb_quxiao@2x.png

1.16 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/mjz_bq@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/mjz_bq@2x.png

1.23 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/mjz_go@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/mjz_go@2x.png

746 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/mjz_q@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/mjz_q@2x.png

2.77 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/mjz_sq@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/mjz_sq@2x.png

1.14 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/mjz_zk@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/mjz_zk@2x.png

1.15 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/navi_back@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/navi_back@2x.png

116 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/ph_back@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/ph_back@2x.png

384 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_back@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_back@2x.png

1.16 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_cell_normal@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_cell_normal@2x.png

1.35 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_def_photoPickerVc@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_def_photoPickerVc@2x.png

1.13 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_def_previewVc@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_def_previewVc@2x.png

1.13 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_enter@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_enter@2x.png

268 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_number_icon@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_number_icon@2x.png

501 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_original_def@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_original_def@2x.png

1.56 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_original_nor@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_original_nor@2x.png

2.12 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_original_normal@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_original_normal@2x.png

902 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_original_sel@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_original_sel@2x.png

620 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_original_select@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_original_select@2x.png

1.31 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_sel_photoPickerVc@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_sel_photoPickerVc@2x.png

1006 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/photo_sel_previewVc@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/photo_sel_previewVc@2x.png

1.16 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/placeImg@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/placeImg@2x.png

4.48 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/preview_number_icon@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/preview_number_icon@2x.png

501 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/preview_original_def@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/preview_original_def@2x.png

392 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/publish_zw@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/publish_zw@2x.png

7.66 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/takePicture80@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/takePicture80@2x.png

1.25 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/takePicture@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/takePicture@2x.png

2.98 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/upload_selection1@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/upload_selection1@2x.png

1.35 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/vi.lproj/Localizable.strings renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/vi.lproj/Localizable.strings
CNLiveImagePickerController/Classes/TZImagePickerController.bundle/video_edit_left@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/video_edit_left@2x.png

203 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/video_edit_right@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/video_edit_right@2x.png

208 Bytes

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/xzq_fh@2x.png renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/xzq_fh@2x.png

1.71 KB

CNLiveImagePickerController/Classes/TZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings
1 1 Binary files a/CNLiveImagePickerController/Classes/TZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings and b/CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings differ
... ...
CNLiveImagePickerController/Classes/TZImagePickerController.bundle/zh-Hant.lproj/Localizable.strings renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/zh-Hant.lproj/Localizable.strings
1 1 Binary files a/CNLiveImagePickerController/Classes/TZImagePickerController.bundle/zh-Hant.lproj/Localizable.strings and b/CNLiveImagePickerController/Classes/CNTZImagePickerController.bundle/zh-Hant.lproj/Localizable.strings differ
... ...
CNLiveImagePickerController/Classes/TZImagePickerController.h renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.h
1 1 //
2   -// TZImagePickerController.h
3   -// TZImagePickerController
  2 +// CNTZImagePickerController.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 // version 2.2.6 - 2018.08.21
8   -// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
  8 +// 更多信息,请前往项目的github地址:https://github.com/banchichen/CNTZImagePickerController
9 9  
10 10 /*
11   - 经过测试,比起xib的方式,把TZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右)
  11 + 经过测试,比起xib的方式,把CNTZAssetCell改用纯代码的方式来写,滑动帧数明显提高了(约提高10帧左右)
12 12  
13 13 最初发现这个问题并修复的是@小鱼周凌宇同学,她的博客地址: http://zhoulingyu.com/
14 14 表示感谢~
... ... @@ -17,13 +17,13 @@
17 17 */
18 18  
19 19 #import <UIKit/UIKit.h>
20   -#import "TZAssetModel.h"
21   -#import "NSBundle+TZImagePicker.h"
22   -#import "TZImageManager.h"
23   -#import "TZVideoPlayerController.h"
24   -#import "TZGifPhotoPreviewController.h"
25   -#import "TZLocationManager.h"
26   -#import "TZPhotoPreviewController.h"
  20 +#import "CNTZAssetModel.h"
  21 +#import "NSBundle+CNTZImagePicker.h"
  22 +#import "CNTZImageManager.h"
  23 +#import "CNTZVideoPlayerController.h"
  24 +#import "CNTZGifPhotoPreviewController.h"
  25 +#import "CNTZLocationManager.h"
  26 +#import "CNTZPhotoPreviewController.h"
27 27  
28 28 #define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
29 29 #define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
... ... @@ -31,15 +31,15 @@
31 31 #define iOS9Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.0f)
32 32 #define iOS9_1Later ([UIDevice currentDevice].systemVersion.floatValue >= 9.1f)
33 33  
34   -@class TZAlbumCell, TZAssetCell;
35   -@protocol TZImagePickerControllerDelegate;
36   -@interface TZImagePickerController : UINavigationController
  34 +@class CNTZAlbumCell, CNTZAssetCell;
  35 +@protocol CNTZImagePickerControllerDelegate;
  36 +@interface CNTZImagePickerController : UINavigationController
37 37  
38 38 #pragma mark -
39 39 /// Use this init method / 用这个初始化方法
40   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate;
41   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate;
42   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc;
  40 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<CNTZImagePickerControllerDelegate>)delegate;
  41 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate;
  42 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc;
43 43 /// This init method just for previewing photos / 用这个初始化方法以预览图片
44 44 - (instancetype)initWithSelectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index;
45 45 /// This init method for crop photo / 用这个初始化方法以裁剪图片
... ... @@ -166,10 +166,10 @@
166 166 /// The photos user have selected
167 167 /// 用户选中过的图片数组
168 168 @property (nonatomic, strong) NSMutableArray *selectedAssets;
169   -@property (nonatomic, strong) NSMutableArray<TZAssetModel *> *selectedModels;
  169 +@property (nonatomic, strong) NSMutableArray<CNTZAssetModel *> *selectedModels;
170 170 @property (nonatomic, strong) NSMutableArray *selectedAssetIds;
171   -- (void)addSelectedModel:(TZAssetModel *)model;
172   -- (void)removeSelectedModel:(TZAssetModel *)model;
  171 +- (void)addSelectedModel:(CNTZAssetModel *)model;
  172 +- (void)removeSelectedModel:(CNTZAssetModel *)model;
173 173  
174 174 /// Minimum selectable photo width, Default is 0
175 175 /// 最小可选中的图片宽度,默认是0,小于这个宽度的图片不可选中
... ... @@ -201,15 +201,15 @@
201 201 @property (nonatomic, copy) void (^photoPreviewPageUIConfigBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);
202 202 @property (nonatomic, copy) void (^videoPreviewPageUIConfigBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
203 203 @property (nonatomic, copy) void (^gifPreviewPageUIConfigBlock)(UIView *toolBar, UIButton *doneButton);
204   -@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
205   -@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  204 +@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  205 +@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
206 206 /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等
207 207 @property (nonatomic, copy) void (^photoPickerPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine);
208 208 @property (nonatomic, copy) void (^photoPreviewPageDidLayoutSubviewsBlock)(UICollectionView *collectionView, UIView *naviBar, UIButton *backButton, UIButton *selectButton, UILabel *indexLabel, UIView *toolBar, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel);
209 209 @property (nonatomic, copy) void (^videoPreviewPageDidLayoutSubviewsBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
210 210 @property (nonatomic, copy) void (^gifPreviewPageDidLayoutSubviewsBlock)(UIView *toolBar, UIButton *doneButton);
211   -@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
212   -@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
  211 +@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(CNTZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
  212 +@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(CNTZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
213 213  
214 214 #pragma mark -
215 215 - (id)showAlertWithTitle:(NSString *)title;
... ... @@ -266,19 +266,19 @@
266 266 // The picker should dismiss itself; when it dismissed these handle will be called.
267 267 // You can also set autoDismiss to NO, then the picker don't dismiss itself.
268 268 // If isOriginalPhoto is YES, user picked the original photo.
269   -// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
  269 +// You can get original photo with asset, by the method [[CNTZImageManager manager] getOriginalPhotoWithAsset:completion:].
270 270 // The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
271 271 // 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的handle
272 272 // 你也可以设置autoDismiss属性为NO,选择器就不会自己dismis了
273 273 // 如果isSelectOriginalPhoto为YES,表明用户选择了原图
274   -// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
  274 +// 你可以通过一个asset获得原图,通过这个方法:[[CNTZImageManager manager] getOriginalPhotoWithAsset:completion:]
275 275 // photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
276 276 @property (nonatomic, copy) void (^didFinishPickingPhotosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto);
277 277 @property (nonatomic, copy) void (^didFinishPickingPhotosWithInfosHandle)(NSArray<UIImage *> *photos,NSArray *assets,BOOL isSelectOriginalPhoto,NSArray<NSDictionary *> *infos);
278 278 @property (nonatomic, copy) void (^imagePickerControllerDidCancelHandle)(void);
279 279  
280 280 #pragma mark - LXG: 视频导出URL
281   -@property (nonatomic, copy) void (^didNewFinishPickingPhotosHandle) (NSArray<UIImage *> *photos,NSArray<TZAssetModel *> *models,NSArray *assets,BOOL isSelectOriginalPhoto);
  281 +@property (nonatomic, copy) void (^didNewFinishPickingPhotosHandle) (NSArray<UIImage *> *photos,NSArray<CNTZAssetModel *> *models,NSArray *assets,BOOL isSelectOriginalPhoto);
282 282  
283 283  
284 284 // If user picking a video, this handle will be called.
... ... @@ -291,37 +291,37 @@
291 291 // 如果用户选择了一个gif图片,下面的handle会被执行
292 292 @property (nonatomic, copy) void (^didFinishPickingGifImageHandle)(UIImage *animatedImage,id sourceAssets);
293 293  
294   -@property (nonatomic, weak) id<TZImagePickerControllerDelegate> pickerDelegate;
  294 +@property (nonatomic, weak) id<CNTZImagePickerControllerDelegate> pickerDelegate;
295 295  
296 296 @end
297 297  
298 298  
299   -@protocol TZImagePickerControllerDelegate <NSObject>
  299 +@protocol CNTZImagePickerControllerDelegate <NSObject>
300 300 @optional
301 301 // The picker should dismiss itself; when it dismissed these handle will be called.
302 302 // You can also set autoDismiss to NO, then the picker don't dismiss itself.
303 303 // If isOriginalPhoto is YES, user picked the original photo.
304   -// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
  304 +// You can get original photo with asset, by the method [[CNTZImageManager manager] getOriginalPhotoWithAsset:completion:].
305 305 // The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
306 306 // 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的handle
307 307 // 你也可以设置autoDismiss属性为NO,选择器就不会自己dismis了
308 308 // 如果isSelectOriginalPhoto为YES,表明用户选择了原图
309   -// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
  309 +// 你可以通过一个asset获得原图,通过这个方法:[[CNTZImageManager manager] getOriginalPhotoWithAsset:completion:]
310 310 // photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
311   -- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;
312   -- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos;
313   -//- (void)imagePickerControllerDidCancel:(TZImagePickerController *)picker __attribute__((deprecated("Use -tz_imagePickerControllerDidCancel:.")));
314   -- (void)tz_imagePickerControllerDidCancel:(TZImagePickerController *)picker;
  311 +- (void)imagePickerController:(CNTZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto;
  312 +- (void)imagePickerController:(CNTZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos;
  313 +//- (void)imagePickerControllerDidCancel:(CNTZImagePickerController *)picker __attribute__((deprecated("Use -CNTZ_imagePickerControllerDidCancel:.")));
  314 +- (void)CNTZ_imagePickerControllerDidCancel:(CNTZImagePickerController *)picker;
315 315  
316 316 // If user picking a video, this callback will be called.
317 317 // If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
318 318 // 如果用户选择了一个视频,下面的handle会被执行
319 319 // 如果系统版本大于iOS8,asset是PHAsset类的对象,否则是ALAsset类的对象
320   -- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset;
  320 +- (void)imagePickerController:(CNTZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset;
321 321  
322 322 // If user picking a gif image, this callback will be called.
323 323 // 如果用户选择了一个gif图片,下面的handle会被执行
324   -- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(id)asset;
  324 +- (void)imagePickerController:(CNTZImagePickerController *)picker didFinishPickingGifImage:(UIImage *)animatedImage sourceAssets:(id)asset;
325 325  
326 326 // Decide album show or not't
327 327 // 决定相册显示与否 albumName:相册名字 result:相册原始数据
... ... @@ -333,7 +333,7 @@
333 333 @end
334 334  
335 335  
336   -@interface TZAlbumPickerController : UIViewController
  336 +@interface CNTZAlbumPickerController : UIViewController
337 337 @property (nonatomic, assign) NSInteger columnNumber;
338 338 @property (assign, nonatomic) BOOL isFirstAppear;
339 339 - (void)configTableView;
... ... @@ -345,21 +345,21 @@
345 345 @end
346 346  
347 347  
348   -@interface NSString (TzExtension)
349   -- (BOOL)tz_containsString:(NSString *)string;
350   -- (CGSize)tz_calculateSizeWithAttributes:(NSDictionary *)attributes maxSize:(CGSize)maxSize;
  348 +@interface NSString (CNTZExtension)
  349 +- (BOOL)CNTZ_containsString:(NSString *)string;
  350 +- (CGSize)CNTZ_calculateSizeWithAttributes:(NSDictionary *)attributes maxSize:(CGSize)maxSize;
351 351 @end
352 352  
353 353  
354   -@interface TZCommonTools : NSObject
355   -+ (BOOL)tz_isIPhoneX;
356   -+ (CGFloat)tz_statusBarHeight;
  354 +@interface CNTZCommonTools : NSObject
  355 ++ (BOOL)CNTZ_isIPhoneX;
  356 ++ (CGFloat)CNTZ_statusBarHeight;
357 357 // 获得Info.plist数据字典
358   -+ (NSDictionary *)tz_getInfoDictionary;
  358 ++ (NSDictionary *)CNTZ_getInfoDictionary;
359 359 @end
360 360  
361 361  
362   -@interface TZImagePickerConfig : NSObject
  362 +@interface CNTZImagePickerConfig : NSObject
363 363 + (instancetype)sharedInstance;
364 364 @property (copy, nonatomic) NSString *preferredLanguage;
365 365 @property(nonatomic, assign) BOOL allowPickingImage;
... ...
CNLiveImagePickerController/Classes/TZImagePickerController.m renamed to CNLiveImagePickerController/Classes/CNTZImagePickerController.m
1 1 //
2   -// TZImagePickerController.m
3   -// TZImagePickerController
  2 +// CNTZImagePickerController.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 // version 2.2.6 - 2018.08.21
8   -// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
9   -
10   -#import "TZImagePickerController.h"
11   -#import "TZPhotoPickerController.h"
12   -#import "TZPhotoPreviewController.h"
13   -#import "TZAssetModel.h"
14   -#import "TZAssetCell.h"
15   -#import "UIView+TZLayout.h"
16   -#import "TZImageManager.h"
  8 +// 更多信息,请前往项目的github地址:https://github.com/banchichen/CNTZImagePickerController
  9 +
  10 +#import "CNTZImagePickerController.h"
  11 +#import "CNTZPhotoPickerController.h"
  12 +#import "CNTZPhotoPreviewController.h"
  13 +#import "CNTZAssetModel.h"
  14 +#import "CNTZAssetCell.h"
  15 +#import "UIView+CNTZLayout.h"
  16 +#import "CNTZImageManager.h"
17 17 #import <sys/utsname.h>
18 18  
19   -@interface TZImagePickerController () {
  19 +@interface CNTZImagePickerController () {
20 20 NSTimer *_timer;
21 21 UILabel *_tipLabel;
22 22 UIButton *_settingBtn;
... ... @@ -30,12 +30,12 @@
30 30  
31 31 UIStatusBarStyle _originStatusBarStyle;
32 32 }
33   -/// Default is 4, Use in photos collectionView in TZPhotoPickerController
34   -/// 默认4列, TZPhotoPickerController中的照片collectionView
  33 +/// Default is 4, Use in photos collectionView in CNTZPhotoPickerController
  34 +/// 默认4列, CNTZPhotoPickerController中的照片collectionView
35 35 @property (nonatomic, assign) NSInteger columnNumber;
36 36 @end
37 37  
38   -@implementation TZImagePickerController
  38 +@implementation CNTZImagePickerController
39 39  
40 40 - (instancetype)init {
41 41 self = [super init];
... ... @@ -53,7 +53,7 @@
53 53 self.view.backgroundColor = [UIColor whiteColor];
54 54 self.navigationBar.barStyle = UIBarStyleBlack;
55 55 self.navigationBar.translucent = YES;
56   - [TZImageManager manager].shouldFixOrientation = NO;
  56 + [CNTZImageManager manager].shouldFixOrientation = NO;
57 57  
58 58 // Default appearance, you can reset these after this method
59 59 // 默认的外观,你可以在这个方法后重置
... ... @@ -120,9 +120,9 @@
120 120 - (void)configBarButtonItemAppearance {
121 121 UIBarButtonItem *barItem;
122 122 if (@available(iOS 9, *)) {
123   - barItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];
  123 + barItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[CNTZImagePickerController class]]];
124 124 } else {
125   - barItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil];
  125 + barItem = [UIBarButtonItem appearanceWhenContainedIn:[CNTZImagePickerController class], nil];
126 126 }
127 127 NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
128 128 textAttrs[NSForegroundColorAttributeName] = self.barItemTextColor;
... ... @@ -146,17 +146,17 @@
146 146 return self.statusBarStyle;
147 147 }
148 148  
149   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<TZImagePickerControllerDelegate>)delegate {
  149 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount delegate:(id<CNTZImagePickerControllerDelegate>)delegate {
150 150 return [self initWithMaxImagesCount:maxImagesCount columnNumber:4 delegate:delegate pushPhotoPickerVc:YES];
151 151 }
152 152  
153   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate {
  153 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate {
154 154 return [self initWithMaxImagesCount:maxImagesCount columnNumber:columnNumber delegate:delegate pushPhotoPickerVc:YES];
155 155 }
156 156  
157   -- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc {
  157 +- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<CNTZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc {
158 158 _pushPhotoPickerVc = pushPhotoPickerVc;
159   - TZAlbumPickerController *albumPickerVc = [[TZAlbumPickerController alloc] init];
  159 + CNTZAlbumPickerController *albumPickerVc = [[CNTZAlbumPickerController alloc] init];
160 160 albumPickerVc.isFirstAppear = YES;
161 161 albumPickerVc.columnNumber = columnNumber;
162 162 self = [super initWithRootViewController:albumPickerVc];
... ... @@ -184,31 +184,31 @@
184 184 self.columnNumber = columnNumber;
185 185 [self configDefaultSetting];
186 186  
187   - if (![[TZImageManager manager] authorizationStatusAuthorized]) {
  187 + if (![[CNTZImageManager manager] authorizationStatusAuthorized]) {
188 188 _tipLabel = [[UILabel alloc] init];
189   - _tipLabel.frame = CGRectMake(8, 120, self.view.tz_width - 16, 60);
  189 + _tipLabel.frame = CGRectMake(8, 120, self.view.CNTZ_width - 16, 60);
190 190 _tipLabel.textAlignment = NSTextAlignmentCenter;
191 191 _tipLabel.numberOfLines = 0;
192 192 _tipLabel.font = [UIFont systemFontOfSize:16];
193 193 _tipLabel.textColor = [UIColor blackColor];
194 194  
195   - NSDictionary *infoDict = [TZCommonTools tz_getInfoDictionary];
  195 + NSDictionary *infoDict = [CNTZCommonTools CNTZ_getInfoDictionary];
196 196 NSString *appName = [infoDict valueForKey:@"CFBundleDisplayName"];
197 197 if (!appName) appName = [infoDict valueForKey:@"CFBundleName"];
198   - NSString *tipText = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName];
  198 + NSString *tipText = [NSString stringWithFormat:[NSBundle CNTZ_localizedStringForKey:@"Allow %@ to access your album in \"Settings -> Privacy -> Photos\""],appName];
199 199 _tipLabel.text = tipText;
200 200 [self.view addSubview:_tipLabel];
201 201  
202 202 if (iOS8Later) {
203 203 _settingBtn = [UIButton buttonWithType:UIButtonTypeSystem];
204 204 [_settingBtn setTitle:self.settingBtnTitleStr forState:UIControlStateNormal];
205   - _settingBtn.frame = CGRectMake(0, 180, self.view.tz_width, 44);
  205 + _settingBtn.frame = CGRectMake(0, 180, self.view.CNTZ_width, 44);
206 206 _settingBtn.titleLabel.font = [UIFont systemFontOfSize:18];
207 207 [_settingBtn addTarget:self action:@selector(settingBtnClick) forControlEvents:UIControlEventTouchUpInside];
208 208 [self.view addSubview:_settingBtn];
209 209 }
210 210  
211   - if ([TZImageManager authorizationStatus] == 0) {
  211 + if ([CNTZImageManager authorizationStatus] == 0) {
212 212 _timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:NO];
213 213 }
214 214 } else {
... ... @@ -220,7 +220,7 @@
220 220  
221 221 /// This init method just for previewing photos / 用这个初始化方法以预览图片
222 222 - (instancetype)initWithSelectedAssets:(NSMutableArray *)selectedAssets selectedPhotos:(NSMutableArray *)selectedPhotos index:(NSInteger)index{
223   - TZPhotoPreviewController *previewVc = [[TZPhotoPreviewController alloc] init];
  223 + CNTZPhotoPreviewController *previewVc = [[CNTZPhotoPreviewController alloc] init];
224 224 self = [super initWithRootViewController:previewVc];
225 225 if (self) {
226 226 self.selectedAssets = [NSMutableArray arrayWithArray:selectedAssets];
... ... @@ -245,7 +245,7 @@
245 245  
246 246 /// This init method for crop photo / 用这个初始化方法以裁剪图片
247 247 - (instancetype)initCropTypeWithAsset:(id)asset photo:(UIImage *)photo completion:(void (^)(UIImage *cropImage,id asset))completion {
248   - TZPhotoPreviewController *previewVc = [[TZPhotoPreviewController alloc] init];
  248 + CNTZPhotoPreviewController *previewVc = [[CNTZPhotoPreviewController alloc] init];
249 249 self = [super initWithRootViewController:previewVc];
250 250 if (self) {
251 251 self.maxImagesCount = 1;
... ... @@ -288,8 +288,8 @@
288 288 self.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];
289 289 [self configDefaultBtnTitle];
290 290  
291   - CGFloat cropViewWH = MIN(self.view.tz_width, self.view.tz_height) / 3 * 2;
292   - self.cropRect = CGRectMake((self.view.tz_width - cropViewWH) / 2, (self.view.tz_height - cropViewWH) / 2, cropViewWH, cropViewWH);
  291 + CGFloat cropViewWH = MIN(self.view.CNTZ_width, self.view.CNTZ_height) / 3 * 2;
  292 + self.cropRect = CGRectMake((self.view.CNTZ_width - cropViewWH) / 2, (self.view.CNTZ_height - cropViewWH) / 2, cropViewWH, cropViewWH);
293 293 }
294 294  
295 295 - (void)configDefaultImageName {
... ... @@ -343,13 +343,13 @@
343 343 }
344 344  
345 345 - (void)configDefaultBtnTitle {
346   - self.doneBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Done"];
347   - self.cancelBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Cancel"];
348   - self.previewBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Preview"];
349   - self.fullImageBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Full image"];
350   - self.settingBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Setting"];
351   - self.processHintStr = [NSBundle tz_localizedStringForKey:@"Processing..."];
352   - self.editBtnTitleStr = [NSBundle tz_localizedStringForKey:@"Edit"];
  346 + self.doneBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Done"];
  347 + self.cancelBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Cancel"];
  348 + self.previewBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Preview"];
  349 + self.fullImageBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Full image"];
  350 + self.settingBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Setting"];
  351 + self.processHintStr = [NSBundle CNTZ_localizedStringForKey:@"Processing..."];
  352 + self.editBtnTitleStr = [NSBundle CNTZ_localizedStringForKey:@"Edit"];
353 353 }
354 354  
355 355 - (void)setShowSelectedIndex:(BOOL)showSelectedIndex {
... ... @@ -357,39 +357,39 @@
357 357 if (showSelectedIndex) {
358 358 self.photoSelImage = [self createImageWithColor:nil size:CGSizeMake(24, 24) radius:12];
359 359 }
360   - [TZImagePickerConfig sharedInstance].showSelectedIndex = showSelectedIndex;
  360 + [CNTZImagePickerConfig sharedInstance].showSelectedIndex = showSelectedIndex;
361 361 }
362 362  
363 363 - (void)setShowPhotoCannotSelectLayer:(BOOL)showPhotoCannotSelectLayer {
364 364 _showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;
365   - [TZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;
  365 + [CNTZImagePickerConfig sharedInstance].showPhotoCannotSelectLayer = showPhotoCannotSelectLayer;
366 366 }
367 367  
368 368 - (void)setNotScaleImage:(BOOL)notScaleImage {
369 369 _notScaleImage = notScaleImage;
370   - [TZImagePickerConfig sharedInstance].notScaleImage = notScaleImage;
  370 + [CNTZImagePickerConfig sharedInstance].notScaleImage = notScaleImage;
371 371 }
372 372  
373 373 - (void)setNeedFixComposition:(BOOL)needFixComposition {
374 374 _needFixComposition = needFixComposition;
375   - [TZImagePickerConfig sharedInstance].needFixComposition = needFixComposition;
  375 + [CNTZImagePickerConfig sharedInstance].needFixComposition = needFixComposition;
376 376 }
377 377  
378 378 - (void)observeAuthrizationStatusChange {
379 379 [_timer invalidate];
380 380 _timer = nil;
381   - if ([TZImageManager authorizationStatus] == 0) {
  381 + if ([CNTZImageManager authorizationStatus] == 0) {
382 382 _timer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(observeAuthrizationStatusChange) userInfo:nil repeats:NO];
383 383 }
384 384  
385   - if ([[TZImageManager manager] authorizationStatusAuthorized]) {
  385 + if ([[CNTZImageManager manager] authorizationStatusAuthorized]) {
386 386 [_tipLabel removeFromSuperview];
387 387 [_settingBtn removeFromSuperview];
388 388  
389 389 [self pushPhotoPickerVc];
390 390  
391   - TZAlbumPickerController *albumPickerVc = (TZAlbumPickerController *)self.visibleViewController;
392   - if ([albumPickerVc isKindOfClass:[TZAlbumPickerController class]]) {
  391 + CNTZAlbumPickerController *albumPickerVc = (CNTZAlbumPickerController *)self.visibleViewController;
  392 + if ([albumPickerVc isKindOfClass:[CNTZAlbumPickerController class]]) {
393 393 [albumPickerVc configTableView];
394 394 }
395 395 }
... ... @@ -399,11 +399,11 @@
399 399 _didPushPhotoPickerVc = NO;
400 400 // 1.6.8 判断是否需要push到照片选择页,如果_pushPhotoPickerVc为NO,则不push
401 401 if (!_didPushPhotoPickerVc && _pushPhotoPickerVc) {
402   - TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];
  402 + CNTZPhotoPickerController *photoPickerVc = [[CNTZPhotoPickerController alloc] init];
403 403 photoPickerVc.isFirstAppear = YES;
404 404 photoPickerVc.columnNumber = self.columnNumber;
405 405 __weak typeof(self) weakSelf = self;
406   - [[TZImageManager manager] getCameraRollAlbum:self.allowPickingVideo allowPickingImage:self.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) {
  406 + [[CNTZImageManager manager] getCameraRollAlbum:self.allowPickingVideo allowPickingImage:self.allowPickingImage needFetchAssets:NO completion:^(CNTZAlbumModel *model) {
407 407 photoPickerVc.model = model;
408 408 [weakSelf pushViewController:photoPickerVc animated:YES];
409 409 self->_didPushPhotoPickerVc = YES;
... ... @@ -414,11 +414,11 @@
414 414 - (id)showAlertWithTitle:(NSString *)title {
415 415 if (iOS8Later) {
416 416 UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
417   - [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle tz_localizedStringForKey:@"OK"] style:UIAlertActionStyleDefault handler:nil]];
  417 + [alertController addAction:[UIAlertAction actionWithTitle:[NSBundle CNTZ_localizedStringForKey:@"OK"] style:UIAlertActionStyleDefault handler:nil]];
418 418 [self presentViewController:alertController animated:YES completion:nil];
419 419 return alertController;
420 420 } else {
421   - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles:nil, nil];
  421 + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:[NSBundle CNTZ_localizedStringForKey:@"OK"] otherButtonTitles:nil, nil];
422 422 [alertView show];
423 423 return alertView;
424 424 }
... ... @@ -503,14 +503,14 @@
503 503  
504 504 - (void)setCircleCropRadius:(NSInteger)circleCropRadius {
505 505 _circleCropRadius = circleCropRadius;
506   - self.cropRect = CGRectMake(self.view.tz_width / 2 - circleCropRadius, self.view.tz_height / 2 - _circleCropRadius, _circleCropRadius * 2, _circleCropRadius * 2);
  506 + self.cropRect = CGRectMake(self.view.CNTZ_width / 2 - circleCropRadius, self.view.CNTZ_height / 2 - _circleCropRadius, _circleCropRadius * 2, _circleCropRadius * 2);
507 507 }
508 508  
509 509 - (void)setCropRect:(CGRect)cropRect {
510 510 _cropRect = cropRect;
511 511 _cropRectPortrait = cropRect;
512 512 CGFloat widthHeight = cropRect.size.width;
513   - _cropRectLandscape = CGRectMake((self.view.tz_height - widthHeight) / 2, cropRect.origin.x, widthHeight, widthHeight);
  513 + _cropRectLandscape = CGRectMake((self.view.CNTZ_height - widthHeight) / 2, cropRect.origin.x, widthHeight, widthHeight);
514 514 }
515 515  
516 516 - (void)setTimeout:(NSInteger)timeout {
... ... @@ -522,9 +522,9 @@
522 522 }
523 523 }
524 524  
525   -- (void)setPickerDelegate:(id<TZImagePickerControllerDelegate>)pickerDelegate {
  525 +- (void)setPickerDelegate:(id<CNTZImagePickerControllerDelegate>)pickerDelegate {
526 526 _pickerDelegate = pickerDelegate;
527   - [TZImageManager manager].pickerDelegate = pickerDelegate;
  527 + [CNTZImageManager manager].pickerDelegate = pickerDelegate;
528 528 }
529 529  
530 530 - (void)setColumnNumber:(NSInteger)columnNumber {
... ... @@ -535,24 +535,24 @@
535 535 _columnNumber = 6;
536 536 }
537 537  
538   - TZAlbumPickerController *albumPickerVc = [self.childViewControllers firstObject];
  538 + CNTZAlbumPickerController *albumPickerVc = [self.childViewControllers firstObject];
539 539 albumPickerVc.columnNumber = _columnNumber;
540   - [TZImageManager manager].columnNumber = _columnNumber;
  540 + [CNTZImageManager manager].columnNumber = _columnNumber;
541 541 }
542 542  
543 543 - (void)setMinPhotoWidthSelectable:(NSInteger)minPhotoWidthSelectable {
544 544 _minPhotoWidthSelectable = minPhotoWidthSelectable;
545   - [TZImageManager manager].minPhotoWidthSelectable = minPhotoWidthSelectable;
  545 + [CNTZImageManager manager].minPhotoWidthSelectable = minPhotoWidthSelectable;
546 546 }
547 547  
548 548 - (void)setMinPhotoHeightSelectable:(NSInteger)minPhotoHeightSelectable {
549 549 _minPhotoHeightSelectable = minPhotoHeightSelectable;
550   - [TZImageManager manager].minPhotoHeightSelectable = minPhotoHeightSelectable;
  550 + [CNTZImageManager manager].minPhotoHeightSelectable = minPhotoHeightSelectable;
551 551 }
552 552  
553 553 - (void)setHideWhenCanNotSelect:(BOOL)hideWhenCanNotSelect {
554 554 _hideWhenCanNotSelect = hideWhenCanNotSelect;
555   - [TZImageManager manager].hideWhenCanNotSelect = hideWhenCanNotSelect;
  555 + [CNTZImageManager manager].hideWhenCanNotSelect = hideWhenCanNotSelect;
556 556 }
557 557  
558 558 - (void)setPhotoPreviewMaxWidth:(CGFloat)photoPreviewMaxWidth {
... ... @@ -562,12 +562,12 @@
562 562 } else if (photoPreviewMaxWidth < 500) {
563 563 _photoPreviewMaxWidth = 500;
564 564 }
565   - [TZImageManager manager].photoPreviewMaxWidth = _photoPreviewMaxWidth;
  565 + [CNTZImageManager manager].photoPreviewMaxWidth = _photoPreviewMaxWidth;
566 566 }
567 567  
568 568 - (void)setPhotoWidth:(CGFloat)photoWidth {
569 569 _photoWidth = photoWidth;
570   - [TZImageManager manager].photoWidth = photoWidth;
  570 + [CNTZImageManager manager].photoWidth = photoWidth;
571 571 }
572 572  
573 573 - (void)setSelectedAssets:(NSMutableArray *)selectedAssets {
... ... @@ -575,7 +575,7 @@
575 575 _selectedModels = [NSMutableArray array];
576 576 _selectedAssetIds = [NSMutableArray array];
577 577 for (id asset in selectedAssets) {
578   - TZAssetModel *model = [TZAssetModel modelWithAsset:asset type:[[TZImageManager manager] getAssetType:asset]];
  578 + CNTZAssetModel *model = [CNTZAssetModel modelWithAsset:asset type:[[CNTZImageManager manager] getAssetType:asset]];
579 579 model.isSelected = YES;
580 580 [self addSelectedModel:model];
581 581 }
... ... @@ -583,7 +583,7 @@
583 583  
584 584 - (void)setAllowPickingImage:(BOOL)allowPickingImage {
585 585 _allowPickingImage = allowPickingImage;
586   - [TZImagePickerConfig sharedInstance].allowPickingImage = allowPickingImage;
  586 + [CNTZImagePickerConfig sharedInstance].allowPickingImage = allowPickingImage;
587 587 if (!allowPickingImage) {
588 588 _allowTakePicture = NO;
589 589 }
... ... @@ -591,7 +591,7 @@
591 591  
592 592 - (void)setAllowPickingVideo:(BOOL)allowPickingVideo {
593 593 _allowPickingVideo = allowPickingVideo;
594   - [TZImagePickerConfig sharedInstance].allowPickingVideo = allowPickingVideo;
  594 + [CNTZImagePickerConfig sharedInstance].allowPickingVideo = allowPickingVideo;
595 595 if (!allowPickingVideo) {
596 596 _allowTakeVideo = NO;
597 597 }
... ... @@ -599,19 +599,19 @@
599 599  
600 600 - (void)setPreferredLanguage:(NSString *)preferredLanguage {
601 601 _preferredLanguage = preferredLanguage;
602   - [TZImagePickerConfig sharedInstance].preferredLanguage = preferredLanguage;
  602 + [CNTZImagePickerConfig sharedInstance].preferredLanguage = preferredLanguage;
603 603 [self configDefaultBtnTitle];
604 604 }
605 605  
606 606 - (void)setLanguageBundle:(NSBundle *)languageBundle {
607 607 _languageBundle = languageBundle;
608   - [TZImagePickerConfig sharedInstance].languageBundle = languageBundle;
  608 + [CNTZImagePickerConfig sharedInstance].languageBundle = languageBundle;
609 609 [self configDefaultBtnTitle];
610 610 }
611 611  
612 612 - (void)setSortAscendingByModificationDate:(BOOL)sortAscendingByModificationDate {
613 613 _sortAscendingByModificationDate = sortAscendingByModificationDate;
614   - [TZImageManager manager].sortAscendingByModificationDate = sortAscendingByModificationDate;
  614 + [CNTZImageManager manager].sortAscendingByModificationDate = sortAscendingByModificationDate;
615 615 }
616 616  
617 617 - (void)settingBtnClick {
... ... @@ -627,18 +627,18 @@
627 627  
628 628 - (void)dealloc {
629 629 // NSLog(@"%@ dealloc",NSStringFromClass(self.class));
630   - NSLog(@"相册_导航_TZImagePickerController_释放");
  630 + NSLog(@"相册_导航_CNTZImagePickerController_释放");
631 631 }
632 632  
633   -- (void)addSelectedModel:(TZAssetModel *)model {
  633 +- (void)addSelectedModel:(CNTZAssetModel *)model {
634 634 [_selectedModels addObject:model];
635   - NSString *assetId = [[TZImageManager manager] getAssetIdentifier:model.asset];
  635 + NSString *assetId = [[CNTZImageManager manager] getAssetIdentifier:model.asset];
636 636 [_selectedAssetIds addObject:assetId];
637 637 }
638 638  
639   -- (void)removeSelectedModel:(TZAssetModel *)model {
  639 +- (void)removeSelectedModel:(CNTZAssetModel *)model {
640 640 [_selectedModels removeObject:model];
641   - NSString *assetId = [[TZImageManager manager] getAssetIdentifier:model.asset];
  641 + NSString *assetId = [[CNTZImageManager manager] getAssetIdentifier:model.asset];
642 642 [_selectedAssetIds removeObject:assetId];
643 643 }
644 644  
... ... @@ -692,7 +692,7 @@
692 692 - (void)viewDidLayoutSubviews {
693 693 [super viewDidLayoutSubviews];
694 694  
695   - _HUDContainer.frame = CGRectMake((self.view.tz_width - 120) / 2, (self.view.tz_height - 90) / 2, 120, 90);
  695 + _HUDContainer.frame = CGRectMake((self.view.CNTZ_width - 120) / 2, (self.view.CNTZ_height - 90) / 2, 120, 90);
696 696 _HUDIndicatorView.frame = CGRectMake(45, 15, 30, 30);
697 697 _HUDLabel.frame = CGRectMake(0,40, 120, 50);
698 698 }
... ... @@ -719,8 +719,8 @@
719 719 }
720 720  
721 721 - (void)callDelegateMethod {
722   - if ([self.pickerDelegate respondsToSelector:@selector(tz_imagePickerControllerDidCancel:)]) {
723   - [self.pickerDelegate tz_imagePickerControllerDidCancel:self];
  722 + if ([self.pickerDelegate respondsToSelector:@selector(CNTZ_imagePickerControllerDidCancel:)]) {
  723 + [self.pickerDelegate CNTZ_imagePickerControllerDidCancel:self];
724 724 }
725 725 if (self.imagePickerControllerDidCancelHandle) {
726 726 self.imagePickerControllerDidCancelHandle();
... ... @@ -730,62 +730,62 @@
730 730 @end
731 731  
732 732  
733   -@interface TZAlbumPickerController ()<UITableViewDataSource,UITableViewDelegate> {
  733 +@interface CNTZAlbumPickerController ()<UITableViewDataSource,UITableViewDelegate> {
734 734 UITableView *_tableView;
735 735 }
736 736 @property (nonatomic, strong) NSMutableArray *albumArr;
737 737 @end
738 738  
739   -@implementation TZAlbumPickerController
  739 +@implementation CNTZAlbumPickerController
740 740  
741 741 - (void)viewDidLoad {
742 742 [super viewDidLoad];
743 743 self.isFirstAppear = YES;
744 744 self.view.backgroundColor = [UIColor whiteColor];
745 745  
746   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  746 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
747 747 self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:imagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:imagePickerVc action:@selector(cancelButtonClick)];
748 748 [self.navigationItem.rightBarButtonItem setTintColor:[UIColor blackColor]];
749 749 }
750 750  
751 751 - (void)viewWillAppear:(BOOL)animated {
752 752 [super viewWillAppear:animated];
753   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  753 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
754 754 [imagePickerVc hideProgressHUD];
755 755 if (imagePickerVc.allowPickingImage) {
756   - self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Photos"];
  756 + self.navigationItem.title = [NSBundle CNTZ_localizedStringForKey:@"Photos"];
757 757 } else if (imagePickerVc.allowPickingVideo) {
758   - self.navigationItem.title = [NSBundle tz_localizedStringForKey:@"Videos"];
  758 + self.navigationItem.title = [NSBundle CNTZ_localizedStringForKey:@"Videos"];
759 759 }
760 760  
761 761 if (self.isFirstAppear && !imagePickerVc.navLeftBarButtonSettingBlock) {
762   - self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
  762 + self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
763 763 }
764 764  
765 765 [self configTableView];
766 766 }
767 767  
768 768 - (void)configTableView {
769   - if (![[TZImageManager manager] authorizationStatusAuthorized]) {
  769 + if (![[CNTZImageManager manager] authorizationStatusAuthorized]) {
770 770 return;
771 771 }
772 772  
773 773 if (self.isFirstAppear) {
774   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  774 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
775 775 [imagePickerVc showProgressHUD];
776 776 }
777 777 __weak typeof(self) weakSelf = self;
778 778 dispatch_async(dispatch_get_global_queue(0, 0), ^{
779 779 dispatch_async(dispatch_get_main_queue(), ^{
780   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)weakSelf.navigationController;
781   - [[TZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage needFetchAssets:!weakSelf.isFirstAppear completion:^(NSArray<TZAlbumModel *> *models) {
  780 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)weakSelf.navigationController;
  781 + [[CNTZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage needFetchAssets:!weakSelf.isFirstAppear completion:^(NSArray<CNTZAlbumModel *> *models) {
782 782  
783 783 if (models == nil) {
784 784 [imagePickerVc hideProgressHUD];
785 785 return;
786 786 }
787 787 self->_albumArr = [NSMutableArray arrayWithArray:models];
788   - for (TZAlbumModel *albumModel in self->_albumArr) {
  788 + for (CNTZAlbumModel *albumModel in self->_albumArr) {
789 789 albumModel.selectedModels = imagePickerVc.selectedModels;
790 790 }
791 791 [imagePickerVc hideProgressHUD];
... ... @@ -801,7 +801,7 @@
801 801 self->_tableView.tableFooterView = [[UIView alloc] init];
802 802 self->_tableView.dataSource = self;
803 803 self->_tableView.delegate = self;
804   - [self->_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@"TZAlbumCell"];
  804 + [self->_tableView registerClass:[CNTZAlbumCell class] forCellReuseIdentifier:@"CNTZAlbumCell"];
805 805 [weakSelf.view addSubview:self->_tableView];
806 806 } else {
807 807 [self->_tableView reloadData];
... ... @@ -815,7 +815,7 @@
815 815 - (void)dealloc {
816 816 // NSLog(@"%@ dealloc",NSStringFromClass(self.class));
817 817  
818   - NSLog(@"相册_相簿_TZAlbumPickerController_dealloc");
  818 + NSLog(@"相册_相簿_CNTZAlbumPickerController_dealloc");
819 819  
820 820 }
821 821  
... ... @@ -826,16 +826,16 @@
826 826  
827 827 CGFloat top = 0;
828 828 CGFloat tableViewHeight = 0;
829   - CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;
  829 + CGFloat naviBarHeight = self.navigationController.navigationBar.CNTZ_height;
830 830 BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;
831 831 if (self.navigationController.navigationBar.isTranslucent) {
832 832 top = naviBarHeight;
833   - if (iOS7Later && !isStatusBarHidden) top += [TZCommonTools tz_statusBarHeight];
834   - tableViewHeight = self.view.tz_height - top;
  833 + if (iOS7Later && !isStatusBarHidden) top += [CNTZCommonTools CNTZ_statusBarHeight];
  834 + tableViewHeight = self.view.CNTZ_height - top;
835 835 } else {
836   - tableViewHeight = self.view.tz_height;
  836 + tableViewHeight = self.view.CNTZ_height;
837 837 }
838   - _tableView.frame = CGRectMake(0, top, self.view.tz_width, tableViewHeight);
  838 + _tableView.frame = CGRectMake(0, top, self.view.CNTZ_width, tableViewHeight);
839 839 }
840 840  
841 841 #pragma mark - UITableViewDataSource && Delegate
... ... @@ -845,8 +845,8 @@
845 845 }
846 846  
847 847 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
848   - TZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TZAlbumCell"];
849   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  848 + CNTZAlbumCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CNTZAlbumCell"];
  849 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
850 850 cell.albumCellDidLayoutSubviewsBlock = imagePickerVc.albumCellDidLayoutSubviewsBlock;
851 851 cell.albumCellDidSetModelBlock = imagePickerVc.albumCellDidSetModelBlock;
852 852 cell.selectedCountButton.backgroundColor = imagePickerVc.iconThemeColor;
... ... @@ -856,9 +856,9 @@
856 856 }
857 857  
858 858 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
859   - TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];
  859 + CNTZPhotoPickerController *photoPickerVc = [[CNTZPhotoPickerController alloc] init];
860 860 photoPickerVc.columnNumber = self.columnNumber;
861   - TZAlbumModel *model = _albumArr[indexPath.row];
  861 + CNTZAlbumModel *model = _albumArr[indexPath.row];
862 862 photoPickerVc.model = model;
863 863 [self.navigationController pushViewController:photoPickerVc animated:YES];
864 864 [tableView deselectRowAtIndexPath:indexPath animated:NO];
... ... @@ -872,7 +872,7 @@
872 872 @implementation UIImage (MyBundle)
873 873  
874 874 + (UIImage *)imageNamedFromMyBundle:(NSString *)name {
875   - NSBundle *imageBundle = [NSBundle tz_imagePickerBundle];
  875 + NSBundle *imageBundle = [NSBundle CNTZ_imagePickerBundle];
876 876 name = [name stringByAppendingString:@"@2x"];
877 877 NSString *imagePath = [imageBundle pathForResource:name ofType:@"png"];
878 878 UIImage *image = [UIImage imageWithContentsOfFile:imagePath];
... ... @@ -887,9 +887,9 @@
887 887 @end
888 888  
889 889  
890   -@implementation NSString (TzExtension)
  890 +@implementation NSString (CNTZExtension)
891 891  
892   -- (BOOL)tz_containsString:(NSString *)string {
  892 +- (BOOL)CNTZ_containsString:(NSString *)string {
893 893 if (iOS8Later) {
894 894 return [self containsString:string];
895 895 } else {
... ... @@ -900,7 +900,7 @@
900 900  
901 901 #pragma clang diagnostic push
902 902 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
903   -- (CGSize)tz_calculateSizeWithAttributes:(NSDictionary *)attributes maxSize:(CGSize)maxSize {
  903 +- (CGSize)CNTZ_calculateSizeWithAttributes:(NSDictionary *)attributes maxSize:(CGSize)maxSize {
904 904 CGSize size;
905 905 if (iOS7Later) {
906 906 size = [self boundingRectWithSize:maxSize options:NSStringDrawingUsesFontLeading attributes:attributes context:nil].size;
... ... @@ -914,29 +914,23 @@
914 914 @end
915 915  
916 916  
917   -@implementation TZCommonTools
  917 +@implementation CNTZCommonTools
918 918  
919   -+ (BOOL)tz_isIPhoneX {
  919 ++ (BOOL)CNTZ_isIPhoneX {
920 920  
921 921 return (CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(375, 812)) ||
922 922 CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(812, 375)) ||
923 923 CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(414, 896)) ||
924   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414)) ||
925   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(360, 780)) ||
926   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(780, 360)) ||
927   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(390, 844)) ||
928   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(844, 390)) ||
929   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(428, 926)) ||
930   - CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(926, 428)));
  924 + CGSizeEqualToSize([UIScreen mainScreen].bounds.size, CGSizeMake(896, 414)));
931 925  
932 926 }
933 927  
934   -+ (CGFloat)tz_statusBarHeight {
935   - return [self tz_isIPhoneX] ? 44 : 20;
  928 ++ (CGFloat)CNTZ_statusBarHeight {
  929 + return [self CNTZ_isIPhoneX] ? 44 : 20;
936 930 }
937 931  
938 932 // 获得Info.plist数据字典
939   -+ (NSDictionary *)tz_getInfoDictionary {
  933 ++ (NSDictionary *)CNTZ_getInfoDictionary {
940 934 NSDictionary *infoDict = [NSBundle mainBundle].localizedInfoDictionary;
941 935 if (!infoDict || !infoDict.count) {
942 936 infoDict = [NSBundle mainBundle].infoDictionary;
... ... @@ -950,14 +944,14 @@
950 944 @end
951 945  
952 946  
953   -@implementation TZImagePickerConfig
  947 +@implementation CNTZImagePickerConfig
954 948  
955 949 + (instancetype)sharedInstance {
956 950 static dispatch_once_t onceToken;
957   - static TZImagePickerConfig *config = nil;
  951 + static CNTZImagePickerConfig *config = nil;
958 952 dispatch_once(&onceToken, ^{
959 953 if (config == nil) {
960   - config = [[TZImagePickerConfig alloc] init];
  954 + config = [[CNTZImagePickerConfig alloc] init];
961 955 config.preferredLanguage = nil;
962 956 config.gifPreviewMaxImagesCount = 200;
963 957 }
... ... @@ -980,7 +974,7 @@
980 974 } else {
981 975 preferredLanguage = @"en";
982 976 }
983   - _languageBundle = [NSBundle bundleWithPath:[[NSBundle tz_imagePickerBundle] pathForResource:preferredLanguage ofType:@"lproj"]];
  977 + _languageBundle = [NSBundle bundleWithPath:[[NSBundle CNTZ_imagePickerBundle] pathForResource:preferredLanguage ofType:@"lproj"]];
984 978 }
985 979  
986 980 @end
... ...
CNLiveImagePickerController/Classes/TZLocationManager.h renamed to CNLiveImagePickerController/Classes/CNTZLocationManager.h
1 1 //
2   -// TZLocationManager.h
3   -// TZImagePickerController
  2 +// CNTZLocationManager.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 2017/06/03.
6 6 // Copyright © 2017年 谭真. All rights reserved.
... ... @@ -10,7 +10,7 @@
10 10 #import <Foundation/Foundation.h>
11 11 #import <CoreLocation/CoreLocation.h>
12 12  
13   -@interface TZLocationManager : NSObject
  13 +@interface CNTZLocationManager : NSObject
14 14  
15 15 + (instancetype)manager;
16 16  
... ...
CNLiveImagePickerController/Classes/TZLocationManager.m renamed to CNLiveImagePickerController/Classes/CNTZLocationManager.m
1 1 //
2   -// TZLocationManager.m
3   -// TZImagePickerController
  2 +// CNTZLocationManager.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 2017/06/03.
6 6 // Copyright © 2017年 谭真. All rights reserved.
7 7 // 定位管理类
8 8  
9   -#import "TZLocationManager.h"
10   -#import "TZImagePickerController.h"
  9 +#import "CNTZLocationManager.h"
  10 +#import "CNTZImagePickerController.h"
11 11  
12   -@interface TZLocationManager ()<CLLocationManagerDelegate>
  12 +@interface CNTZLocationManager ()<CLLocationManagerDelegate>
13 13 @property (nonatomic, strong) CLLocationManager *locationManager;
14 14 /// 定位成功的回调block
15 15 @property (nonatomic, copy) void (^successBlock)(NSArray<CLLocation *> *);
... ... @@ -19,10 +19,10 @@
19 19 @property (nonatomic, copy) void (^failureBlock)(NSError *error);
20 20 @end
21 21  
22   -@implementation TZLocationManager
  22 +@implementation CNTZLocationManager
23 23  
24 24 + (instancetype)manager {
25   - static TZLocationManager *manager;
  25 + static CNTZLocationManager *manager;
26 26 static dispatch_once_t onceToken;
27 27 dispatch_once(&onceToken, ^{
28 28 manager = [[self alloc] init];
... ...
CNLiveImagePickerController/Classes/TZPhotoPickerController.h renamed to CNLiveImagePickerController/Classes/CNTZPhotoPickerController.h
1 1 //
2   -// TZPhotoPickerController.h
3   -// TZImagePickerController
  2 +// CNTZPhotoPickerController.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
... ... @@ -8,15 +8,15 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -@class TZAlbumModel;
12   -@interface TZPhotoPickerController : UIViewController
  11 +@class CNTZAlbumModel;
  12 +@interface CNTZPhotoPickerController : UIViewController
13 13  
14 14 @property (nonatomic, assign) BOOL isFirstAppear;
15 15 @property (nonatomic, assign) NSInteger columnNumber;
16   -@property (nonatomic, strong) TZAlbumModel *model;
  16 +@property (nonatomic, strong) CNTZAlbumModel *model;
17 17 @end
18 18  
19 19  
20   -@interface TZCollectionView : UICollectionView
  20 +@interface CNTZCollectionView : UICollectionView
21 21  
22 22 @end
... ...
CNLiveImagePickerController/Classes/TZPhotoPickerController.m renamed to CNLiveImagePickerController/Classes/CNTZPhotoPickerController.m
1 1 //
2   -// TZPhotoPickerController.m
3   -// TZImagePickerController
  2 +// CNTZPhotoPickerController.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZPhotoPickerController.h"
10   -#import "TZImagePickerController.h"
11   -#import "TZPhotoPreviewController.h"
12   -#import "TZAssetCell.h"
13   -#import "TZAssetModel.h"
14   -#import "UIView+TZLayout.h"
15   -#import "TZImageManager.h"
16   -#import "TZVideoPlayerController.h"
17   -#import "TZGifPhotoPreviewController.h"
18   -#import "TZLocationManager.h"
  9 +#import "CNTZPhotoPickerController.h"
  10 +#import "CNTZImagePickerController.h"
  11 +#import "CNTZPhotoPreviewController.h"
  12 +#import "CNTZAssetCell.h"
  13 +#import "CNTZAssetModel.h"
  14 +#import "UIView+CNTZLayout.h"
  15 +#import "CNTZImageManager.h"
  16 +#import "CNTZVideoPlayerController.h"
  17 +#import "CNTZGifPhotoPreviewController.h"
  18 +#import "CNTZLocationManager.h"
19 19 #import <MobileCoreServices/MobileCoreServices.h>
20 20 #import <AssetsLibrary/AssetsLibrary.h>///lxg
21 21  
... ... @@ -86,7 +86,7 @@
86 86  
87 87 @end
88 88  
89   -@interface TZPhotoPickerController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate> {
  89 +@interface CNTZPhotoPickerController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate> {
90 90 NSMutableArray *_models;
91 91  
92 92 UIView *_bottomToolBar;
... ... @@ -107,7 +107,7 @@
107 107 }
108 108 @property CGRect previousPreheatRect;
109 109 @property (nonatomic, assign) BOOL isSelectOriginalPhoto;
110   -@property (nonatomic, strong) TZCollectionView *collectionView;
  110 +@property (nonatomic, strong) CNTZCollectionView *collectionView;
111 111 @property (strong, nonatomic) UICollectionViewFlowLayout *layout;
112 112 @property (nonatomic, strong) UIImagePickerController *imagePickerVc;
113 113 @property (strong, nonatomic) CLLocation *location;
... ... @@ -117,7 +117,7 @@
117 117 static CGSize AssetGridThumbnailSize;
118 118 static CGFloat itemMargin = 5;
119 119  
120   -@implementation TZPhotoPickerController
  120 +@implementation CNTZPhotoPickerController
121 121  
122 122 #pragma clang diagnostic push
123 123 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
... ... @@ -130,15 +130,15 @@ static CGFloat itemMargin = 5;
130 130 _imagePickerVc.navigationBar.barTintColor = self.navigationController.navigationBar.barTintColor;
131 131 }
132 132 _imagePickerVc.navigationBar.tintColor = self.navigationController.navigationBar.tintColor;
133   - UIBarButtonItem *tzBarItem, *BarItem;
  133 + UIBarButtonItem *CNTZBarItem, *BarItem;
134 134 if (@available(iOS 9, *)) {
135   - tzBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[TZImagePickerController class]]];
  135 + CNTZBarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[CNTZImagePickerController class]]];
136 136 BarItem = [UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UIImagePickerController class]]];
137 137 } else {
138   - tzBarItem = [UIBarButtonItem appearanceWhenContainedIn:[TZImagePickerController class], nil];
  138 + CNTZBarItem = [UIBarButtonItem appearanceWhenContainedIn:[CNTZImagePickerController class], nil];
139 139 BarItem = [UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil];
140 140 }
141   - NSDictionary *titleTextAttributes = [tzBarItem titleTextAttributesForState:UIControlStateNormal];
  141 + NSDictionary *titleTextAttributes = [CNTZBarItem titleTextAttributesForState:UIControlStateNormal];
142 142 [BarItem setTitleTextAttributes:titleTextAttributes forState:UIControlStateNormal];
143 143 }
144 144 return _imagePickerVc;
... ... @@ -148,35 +148,35 @@ static CGFloat itemMargin = 5;
148 148 [super viewDidLoad];
149 149 _isClickDone = NO;
150 150 self.isFirstAppear = YES;
151   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
152   - _isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto;
  151 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  152 + _isSelectOriginalPhoto = CNTZImagePickerVc.isSelectOriginalPhoto;
153 153 _shouldScrollToBottom = YES;
154 154 self.view.backgroundColor = [UIColor whiteColor];
155 155 self.navigationItem.title = _model.name;
156   - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:tzImagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:tzImagePickerVc action:@selector(cancelButtonClick)];
157   - if (tzImagePickerVc.navLeftBarButtonSettingBlock) {
  156 + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:CNTZImagePickerVc.cancelBtnTitleStr style:UIBarButtonItemStylePlain target:CNTZImagePickerVc action:@selector(cancelButtonClick)];
  157 + if (CNTZImagePickerVc.navLeftBarButtonSettingBlock) {
158 158 UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
159 159 leftButton.frame = CGRectMake(0, 0, 44, 44);
160 160 [leftButton addTarget:self action:@selector(navLeftBarButtonClick) forControlEvents:UIControlEventTouchUpInside];
161   - tzImagePickerVc.navLeftBarButtonSettingBlock(leftButton);
  161 + CNTZImagePickerVc.navLeftBarButtonSettingBlock(leftButton);
162 162 self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
163   - } else if (tzImagePickerVc.childViewControllers.count) {
164   - [tzImagePickerVc.childViewControllers firstObject].navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
  163 + } else if (CNTZImagePickerVc.childViewControllers.count) {
  164 + [CNTZImagePickerVc.childViewControllers firstObject].navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
165 165 }
166   - _showTakePhotoBtn = _model.isCameraRoll && ((tzImagePickerVc.allowTakePicture && tzImagePickerVc.allowPickingImage) || (tzImagePickerVc.allowTakeVideo && tzImagePickerVc.allowPickingVideo));
  166 + _showTakePhotoBtn = _model.isCameraRoll && ((CNTZImagePickerVc.allowTakePicture && CNTZImagePickerVc.allowPickingImage) || (CNTZImagePickerVc.allowTakeVideo && CNTZImagePickerVc.allowPickingVideo));
167 167 // [self resetCachedAssets];
168 168 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeStatusBarOrientationNotification:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
169 169 }
170 170  
171 171 - (void)fetchAssetModels {
172   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  172 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
173 173 if (_isFirstAppear && !_model.models.count) {
174   - [tzImagePickerVc showProgressHUD];
  174 + [CNTZImagePickerVc showProgressHUD];
175 175 }
176 176 __weak typeof(self) weakSelf = self;
177 177 dispatch_async(dispatch_get_global_queue(0, 0), ^{
178   - if (!tzImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && iOS8Later && self->_model.isCameraRoll) {
179   - [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:YES completion:^(TZAlbumModel *model) {
  178 + if (!CNTZImagePickerVc.sortAscendingByModificationDate && self->_isFirstAppear && iOS8Later && self->_model.isCameraRoll) {
  179 + [[CNTZImageManager manager] getCameraRollAlbum:CNTZImagePickerVc.allowPickingVideo allowPickingImage:CNTZImagePickerVc.allowPickingImage needFetchAssets:YES completion:^(CNTZAlbumModel *model) {
180 180 self->_model = model;
181 181 self->_models = [NSMutableArray arrayWithArray:self->_model.models];
182 182 [weakSelf initSubviews];
... ... @@ -184,7 +184,7 @@ static CGFloat itemMargin = 5;
184 184 } else {
185 185 if (self->_showTakePhotoBtn || !iOS8Later || self->_isFirstAppear) {
186 186 __weak typeof(self) weakSelf = self;
187   - [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {
  187 + [[CNTZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<CNTZAssetModel *> *models) {
188 188 self->_models = [NSMutableArray arrayWithArray:models];
189 189 [weakSelf initSubviews];
190 190 }];
... ... @@ -199,8 +199,8 @@ static CGFloat itemMargin = 5;
199 199 - (void)initSubviews {
200 200 __weak typeof(self) weakSelf = self;
201 201 dispatch_async(dispatch_get_main_queue(), ^{
202   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)weakSelf.navigationController;
203   - [tzImagePickerVc hideProgressHUD];
  202 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)weakSelf.navigationController;
  203 + [CNTZImagePickerVc hideProgressHUD];
204 204  
205 205 [weakSelf checkSelectedModels];
206 206 [weakSelf configCollectionView];
... ... @@ -213,8 +213,8 @@ static CGFloat itemMargin = 5;
213 213  
214 214 - (void)viewWillDisappear:(BOOL)animated {
215 215 [super viewWillDisappear:animated];
216   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
217   - tzImagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
  216 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  217 + CNTZImagePickerVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
218 218 }
219 219  
220 220 - (BOOL)prefersStatusBarHidden {
... ... @@ -223,7 +223,7 @@ static CGFloat itemMargin = 5;
223 223  
224 224 - (void)configCollectionView {
225 225 _layout = [[UICollectionViewFlowLayout alloc] init];
226   - _collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
  226 + _collectionView = [[CNTZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
227 227 _collectionView.backgroundColor = [UIColor whiteColor];
228 228 _collectionView.dataSource = self;
229 229 _collectionView.delegate = self;
... ... @@ -231,13 +231,13 @@ static CGFloat itemMargin = 5;
231 231 _collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin);
232 232  
233 233 if (_showTakePhotoBtn) {
234   - _collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width);
  234 + _collectionView.contentSize = CGSizeMake(self.view.CNTZ_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.CNTZ_width);
235 235 } else {
236   - _collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber - 1) / self.columnNumber) * self.view.tz_width);
  236 + _collectionView.contentSize = CGSizeMake(self.view.CNTZ_width, ((_model.count + self.columnNumber - 1) / self.columnNumber) * self.view.CNTZ_width);
237 237 }
238 238 [self.view addSubview:_collectionView];
239   - [_collectionView registerClass:[TZAssetCell class] forCellWithReuseIdentifier:@"TZAssetCell"];
240   - [_collectionView registerClass:[TZAssetCameraCell class] forCellWithReuseIdentifier:@"TZAssetCameraCell"];
  239 + [_collectionView registerClass:[CNTZAssetCell class] forCellWithReuseIdentifier:@"CNTZAssetCell"];
  240 + [_collectionView registerClass:[CNTZAssetCameraCell class] forCellWithReuseIdentifier:@"CNTZAssetCameraCell"];
241 241 }
242 242  
243 243 - (void)viewWillAppear:(BOOL)animated {
... ... @@ -263,8 +263,8 @@ static CGFloat itemMargin = 5;
263 263 }
264 264  
265 265 - (void)configBottomToolBar {
266   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
267   - if (!tzImagePickerVc.showSelectBtn) return;
  266 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  267 + if (!CNTZImagePickerVc.showSelectBtn) return;
268 268  
269 269 _bottomToolBar = [[UIView alloc] initWithFrame:CGRectZero];
270 270 CGFloat rgb = 253 / 255.0;
... ... @@ -273,27 +273,27 @@ static CGFloat itemMargin = 5;
273 273 _previewButton = [UIButton buttonWithType:UIButtonTypeCustom];
274 274 [_previewButton addTarget:self action:@selector(previewButtonClick) forControlEvents:UIControlEventTouchUpInside];
275 275 _previewButton.titleLabel.font = [UIFont systemFontOfSize:16];
276   - [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];
277   - [_previewButton setTitle:tzImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled];
  276 + [_previewButton setTitle:CNTZImagePickerVc.previewBtnTitleStr forState:UIControlStateNormal];
  277 + [_previewButton setTitle:CNTZImagePickerVc.previewBtnTitleStr forState:UIControlStateDisabled];
278 278 [_previewButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
279 279 [_previewButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
280   - _previewButton.enabled = tzImagePickerVc.selectedModels.count;
  280 + _previewButton.enabled = CNTZImagePickerVc.selectedModels.count;
281 281  
282   - if (tzImagePickerVc.allowPickingOriginalPhoto) {
  282 + if (CNTZImagePickerVc.allowPickingOriginalPhoto) {
283 283 _originalPhotoButton = [UIButton buttonWithType:UIButtonTypeCustom];
284 284 _originalPhotoButton.imageEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
285 285 [_originalPhotoButton addTarget:self action:@selector(originalPhotoButtonClick) forControlEvents:UIControlEventTouchUpInside];
286 286 _originalPhotoButton.titleLabel.font = [UIFont systemFontOfSize:16];
287   - [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];
288   - [_originalPhotoButton setTitle:tzImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];
  287 + [_originalPhotoButton setTitle:CNTZImagePickerVc.fullImageBtnTitleStr forState:UIControlStateNormal];
  288 + [_originalPhotoButton setTitle:CNTZImagePickerVc.fullImageBtnTitleStr forState:UIControlStateSelected];
289 289 [_originalPhotoButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
290 290 [_originalPhotoButton setTitleColor:[UIColor blackColor] forState:UIControlStateSelected];
291   - [_originalPhotoButton setImage:tzImagePickerVc.photoOriginDefImage forState:UIControlStateNormal];
292   - [_originalPhotoButton setImage:tzImagePickerVc.photoOriginSelImage forState:UIControlStateSelected];
  291 + [_originalPhotoButton setImage:CNTZImagePickerVc.photoOriginDefImage forState:UIControlStateNormal];
  292 + [_originalPhotoButton setImage:CNTZImagePickerVc.photoOriginSelImage forState:UIControlStateSelected];
293 293 _originalPhotoButton.imageView.clipsToBounds = YES;
294 294 _originalPhotoButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
295 295 _originalPhotoButton.selected = _isSelectOriginalPhoto;
296   - _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;
  296 + _originalPhotoButton.enabled = CNTZImagePickerVc.selectedModels.count > 0;
297 297  
298 298 _originalPhotoLabel = [[UILabel alloc] init];
299 299 _originalPhotoLabel.textAlignment = NSTextAlignmentLeft;
... ... @@ -305,14 +305,14 @@ static CGFloat itemMargin = 5;
305 305 _doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
306 306 _doneButton.titleLabel.font = [UIFont systemFontOfSize:16];
307 307 [_doneButton addTarget:self action:@selector(doneButtonClick) forControlEvents:UIControlEventTouchUpInside];
308   - [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
309   - [_doneButton setTitle:tzImagePickerVc.doneBtnTitleStr forState:UIControlStateDisabled];
310   - [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
311   - [_doneButton setTitleColor:tzImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];
312   - _doneButton.enabled = tzImagePickerVc.selectedModels.count || tzImagePickerVc.alwaysEnableDoneBtn;
  308 + [_doneButton setTitle:CNTZImagePickerVc.doneBtnTitleStr forState:UIControlStateNormal];
  309 + [_doneButton setTitle:CNTZImagePickerVc.doneBtnTitleStr forState:UIControlStateDisabled];
  310 + [_doneButton setTitleColor:CNTZImagePickerVc.oKButtonTitleColorNormal forState:UIControlStateNormal];
  311 + [_doneButton setTitleColor:CNTZImagePickerVc.oKButtonTitleColorDisabled forState:UIControlStateDisabled];
  312 + _doneButton.enabled = CNTZImagePickerVc.selectedModels.count || CNTZImagePickerVc.alwaysEnableDoneBtn;
313 313  
314   - _numberImageView = [[UIImageView alloc] initWithImage:tzImagePickerVc.photoNumberIconImage];
315   - _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;
  314 + _numberImageView = [[UIImageView alloc] initWithImage:CNTZImagePickerVc.photoNumberIconImage];
  315 + _numberImageView.hidden = CNTZImagePickerVc.selectedModels.count <= 0;
316 316 _numberImageView.clipsToBounds = YES;
317 317 _numberImageView.contentMode = UIViewContentModeScaleAspectFit;
318 318 _numberImageView.backgroundColor = [UIColor clearColor];
... ... @@ -321,13 +321,13 @@ static CGFloat itemMargin = 5;
321 321 _numberLabel.font = [UIFont systemFontOfSize:15];
322 322 _numberLabel.textColor = [UIColor whiteColor];
323 323 _numberLabel.textAlignment = NSTextAlignmentCenter;
324   - _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count];
325   - _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;
  324 + _numberLabel.text = [NSString stringWithFormat:@"%zd",CNTZImagePickerVc.selectedModels.count];
  325 + _numberLabel.hidden = CNTZImagePickerVc.selectedModels.count <= 0;
326 326 _numberLabel.backgroundColor = [UIColor clearColor];
327 327 #pragma mark - 添加: 选择图片个数显示(LXG)
328 328 _numberImageView.hidden = YES;
329 329 _numberLabel.hidden = YES;
330   - [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal];
  330 + [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",CNTZImagePickerVc.selectedModels.count] forState:UIControlStateNormal];
331 331  
332 332 _divideLine = [[UIView alloc] init];
333 333 CGFloat rgb2 = 222 / 255.0;
... ... @@ -342,8 +342,8 @@ static CGFloat itemMargin = 5;
342 342 [self.view addSubview:_bottomToolBar];
343 343 [_originalPhotoButton addSubview:_originalPhotoLabel];
344 344  
345   - if (tzImagePickerVc.photoPickerPageUIConfigBlock) {
346   - tzImagePickerVc.photoPickerPageUIConfigBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);
  345 + if (CNTZImagePickerVc.photoPickerPageUIConfigBlock) {
  346 + CNTZImagePickerVc.photoPickerPageUIConfigBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);
347 347 }
348 348 }
349 349  
... ... @@ -352,22 +352,22 @@ static CGFloat itemMargin = 5;
352 352 - (void)viewDidLayoutSubviews {
353 353 [super viewDidLayoutSubviews];
354 354  
355   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  355 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
356 356  
357 357 CGFloat top = 0;
358 358 CGFloat collectionViewHeight = 0;
359   - CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;
  359 + CGFloat naviBarHeight = self.navigationController.navigationBar.CNTZ_height;
360 360 BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;
361   - CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 50 + (83 - 49) : 50;
  361 + CGFloat toolBarHeight = [CNTZCommonTools CNTZ_isIPhoneX] ? 50 + (83 - 49) : 50;
362 362 if (self.navigationController.navigationBar.isTranslucent) {
363 363 top = naviBarHeight;
364   - if (iOS7Later && !isStatusBarHidden) top += [TZCommonTools tz_statusBarHeight];
365   - collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight - top : self.view.tz_height - top;;
  364 + if (iOS7Later && !isStatusBarHidden) top += [CNTZCommonTools CNTZ_statusBarHeight];
  365 + collectionViewHeight = CNTZImagePickerVc.showSelectBtn ? self.view.CNTZ_height - toolBarHeight - top : self.view.CNTZ_height - top;;
366 366 } else {
367   - collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight : self.view.tz_height;
  367 + collectionViewHeight = CNTZImagePickerVc.showSelectBtn ? self.view.CNTZ_height - toolBarHeight : self.view.CNTZ_height;
368 368 }
369   - _collectionView.frame = CGRectMake(0, top, self.view.tz_width, collectionViewHeight);
370   - CGFloat itemWH = (self.view.tz_width - (self.columnNumber + 1) * itemMargin) / self.columnNumber;
  369 + _collectionView.frame = CGRectMake(0, top, self.view.CNTZ_width, collectionViewHeight);
  370 + CGFloat itemWH = (self.view.CNTZ_width - (self.columnNumber + 1) * itemMargin) / self.columnNumber;
371 371 _layout.itemSize = CGSizeMake(itemWH, itemWH);
372 372 _layout.minimumInteritemSpacing = itemMargin;
373 373 _layout.minimumLineSpacing = itemMargin;
... ... @@ -379,35 +379,35 @@ static CGFloat itemMargin = 5;
379 379  
380 380 CGFloat toolBarTop = 0;
381 381 if (!self.navigationController.navigationBar.isHidden) {
382   - toolBarTop = self.view.tz_height - toolBarHeight;
  382 + toolBarTop = self.view.CNTZ_height - toolBarHeight;
383 383 } else {
384 384 CGFloat navigationHeight = naviBarHeight;
385   - if (iOS7Later) navigationHeight += [TZCommonTools tz_statusBarHeight];
386   - toolBarTop = self.view.tz_height - toolBarHeight - navigationHeight;
  385 + if (iOS7Later) navigationHeight += [CNTZCommonTools CNTZ_statusBarHeight];
  386 + toolBarTop = self.view.CNTZ_height - toolBarHeight - navigationHeight;
387 387 }
388   - _bottomToolBar.frame = CGRectMake(0, toolBarTop, self.view.tz_width, toolBarHeight);
389   - CGFloat previewWidth = [tzImagePickerVc.previewBtnTitleStr tz_calculateSizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} maxSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width + 2;
390   - if (!tzImagePickerVc.allowPreview) {
  388 + _bottomToolBar.frame = CGRectMake(0, toolBarTop, self.view.CNTZ_width, toolBarHeight);
  389 + CGFloat previewWidth = [CNTZImagePickerVc.previewBtnTitleStr CNTZ_calculateSizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} maxSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width + 2;
  390 + if (!CNTZImagePickerVc.allowPreview) {
391 391 previewWidth = 0.0;
392 392 }
393 393 _previewButton.frame = CGRectMake(10, 3, previewWidth, 44);
394   - _previewButton.tz_width = !tzImagePickerVc.showSelectBtn ? 0 : previewWidth;
395   - if (tzImagePickerVc.allowPickingOriginalPhoto) {
396   - CGFloat fullImageWidth = [tzImagePickerVc.fullImageBtnTitleStr tz_calculateSizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} maxSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width;
  394 + _previewButton.CNTZ_width = !CNTZImagePickerVc.showSelectBtn ? 0 : previewWidth;
  395 + if (CNTZImagePickerVc.allowPickingOriginalPhoto) {
  396 + CGFloat fullImageWidth = [CNTZImagePickerVc.fullImageBtnTitleStr CNTZ_calculateSizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13]} maxSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)].width;
397 397 _originalPhotoButton.frame = CGRectMake(CGRectGetMaxX(_previewButton.frame), 0, fullImageWidth + 56, 50);
398 398 _originalPhotoLabel.frame = CGRectMake(fullImageWidth + 46, 0, 80, 50);
399 399 }
400 400 [_doneButton sizeToFit];
401   - _doneButton.frame = CGRectMake(self.view.tz_width - 60 - 12, 0, 60, 50);
402   - _numberImageView.frame = CGRectMake(_doneButton.tz_left - 24 - 5, 13, 24, 24);
  401 + _doneButton.frame = CGRectMake(self.view.CNTZ_width - _doneButton.CNTZ_width - 12, 0, _doneButton.CNTZ_width, 50);
  402 + _numberImageView.frame = CGRectMake(_doneButton.CNTZ_left - 24 - 5, 13, 24, 24);
403 403 _numberLabel.frame = _numberImageView.frame;
404   - _divideLine.frame = CGRectMake(0, 0, self.view.tz_width, 1);
  404 + _divideLine.frame = CGRectMake(0, 0, self.view.CNTZ_width, 1);
405 405  
406   - [TZImageManager manager].columnNumber = [TZImageManager manager].columnNumber;
  406 + [CNTZImageManager manager].columnNumber = [CNTZImageManager manager].columnNumber;
407 407 [self.collectionView reloadData];
408 408  
409   - if (tzImagePickerVc.photoPickerPageDidLayoutSubviewsBlock) {
410   - tzImagePickerVc.photoPickerPageDidLayoutSubviewsBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);
  409 + if (CNTZImagePickerVc.photoPickerPageDidLayoutSubviewsBlock) {
  410 + CNTZImagePickerVc.photoPickerPageDidLayoutSubviewsBlock(_collectionView, _bottomToolBar, _previewButton, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel, _divideLine);
411 411 }
412 412 }
413 413  
... ... @@ -424,7 +424,7 @@ static CGFloat itemMargin = 5;
424 424  
425 425 - (void)previewButtonClick {
426 426 //根据进入方式不同判断
427   - TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
  427 + CNTZPhotoPreviewController *photoPreviewVc = [[CNTZPhotoPreviewController alloc] init];
428 428 photoPreviewVc.enterType = PhotoPreviewEnterTypeSelected;
429 429 [self pushPhotoPrevireViewController:photoPreviewVc needCheckSelectedModels:YES];
430 430 }
... ... @@ -442,15 +442,15 @@ static CGFloat itemMargin = 5;
442 442 #pragma mark - TODO: done 完成
443 443 - (void)doneButtonClick {
444 444 NSLog(@"-----相册完成选择----");
445   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  445 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
446 446 #pragma mark - 筛选
447 447 /*** 筛选 ***/
448 448 __block BOOL isBad = NO;
449 449 __weak typeof(self) weakSelf = self;
450   - [tzImagePickerVc.selectedModels enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(TZAssetModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  450 + [CNTZImagePickerVc.selectedModels enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(CNTZAssetModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
451 451  
452 452 /*** 筛选损坏视频 ***/
453   - if (obj.type == TZAssetModelMediaTypeVideo) {
  453 + if (obj.type == CNTZAssetModelMediaTypeVideo) {
454 454 NSURL *url = [obj.asset movieURL];
455 455 if (!url) {
456 456 isBad = YES;
... ... @@ -459,8 +459,8 @@ static CGFloat itemMargin = 5;
459 459 }
460 460  
461 461 /*** 筛选损坏图片 ***/
462   - if (obj.type == TZAssetModelMediaTypePhotoGif
463   - || obj.type == TZAssetModelMediaTypePhoto) {
  462 + if (obj.type == CNTZAssetModelMediaTypePhotoGif
  463 + || obj.type == CNTZAssetModelMediaTypePhoto) {
464 464  
465 465 UIImage *photo = [obj.asset getPhoto];
466 466 if (!photo) {
... ... @@ -473,7 +473,7 @@ static CGFloat itemMargin = 5;
473 473  
474 474 if (isBad) {
475 475 NSString *imgShowStr = [NSString stringWithFormat:@"选择中内容已损坏,已从选中删除"];
476   - [tzImagePickerVc showAlertWithTitle:imgShowStr];
  476 + [CNTZImagePickerVc showAlertWithTitle:imgShowStr];
477 477 [weakSelf checkSelectedModels];
478 478 [weakSelf refreshBottomToolBarStatus];
479 479 [weakSelf.collectionView reloadData];
... ... @@ -492,17 +492,24 @@ static CGFloat itemMargin = 5;
492 492 }
493 493  
494 494 // 1.6.8 判断是否满足最小必选张数的限制
495   - if (tzImagePickerVc.minImagesCount && tzImagePickerVc.selectedModels.count < tzImagePickerVc.minImagesCount) {
496   - NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Select a minimum of %zd photos"], tzImagePickerVc.minImagesCount];
497   - [tzImagePickerVc showAlertWithTitle:title];
  495 + if (CNTZImagePickerVc.minImagesCount && CNTZImagePickerVc.selectedModels.count < CNTZImagePickerVc.minImagesCount) {
  496 + NSString *title = [NSString stringWithFormat:[NSBundle CNTZ_localizedStringForKey:@"Select a minimum of %zd photos"], CNTZImagePickerVc.minImagesCount];
  497 + [CNTZImagePickerVc showAlertWithTitle:title];
498 498 return;
499 499 }
500 500  
501 501  
502 502 dispatch_async(dispatch_get_main_queue(), ^{
503   - [tzImagePickerVc showProgressHUD];
  503 + [CNTZImagePickerVc showProgressHUD];
504 504 });
  505 + NSString *outputPath = @"";
  506 + if ([NSString isEmpty:CNTZImagePickerVc.conversationId]) {
  507 + outputPath = [CNLiveBusinessTools chatFilePathByUserId:CNUserShareModel.uid];
  508 + }else{
505 509  
  510 + outputPath = [CNLiveBusinessTools getChatImageAndVideoUploadIMCacheDirectory];
  511 +
  512 + }
506 513 dispatch_async(dispatch_get_global_queue(0, 0), ^{
507 514 NSMutableArray *selectedModels = [NSMutableArray array];
508 515 NSMutableArray *assets = [NSMutableArray array];
... ... @@ -510,15 +517,15 @@ static CGFloat itemMargin = 5;
510 517 NSMutableArray *infoArr = [NSMutableArray array];
511 518  
512 519 dispatch_queue_t queue = dispatch_queue_create("export", DISPATCH_QUEUE_SERIAL);//串行
513   - if (tzImagePickerVc.onlyReturnAsset) {
514   - for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
515   - TZAssetModel *model = tzImagePickerVc.selectedModels[i];
  520 + if (CNTZImagePickerVc.onlyReturnAsset) {
  521 + for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
  522 + CNTZAssetModel *model = CNTZImagePickerVc.selectedModels[i];
516 523 [assets addObject:model.asset];
517 524 }
518 525  
519 526 }else {
520 527 /*** 默认添加数字站位 ***/
521   - for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
  528 + for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
522 529  
523 530 [selectedModels addObject:@1];
524 531 [photos addObject:@1];
... ... @@ -529,16 +536,16 @@ static CGFloat itemMargin = 5;
529 536  
530 537 __block BOOL havenotShowAlert = YES;
531 538 __block id alertView;
532   - [TZImageManager manager].shouldFixOrientation = YES;
533   - for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
534   - TZAssetModel *model = tzImagePickerVc.selectedModels[i];
  539 + [CNTZImageManager manager].shouldFixOrientation = YES;
  540 + for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
  541 + CNTZAssetModel *model = CNTZImagePickerVc.selectedModels[i];
535 542 ///导出
536 543 dispatch_sync(queue, ^{
537 544 // 判断是否导出视频url
538   - if (tzImagePickerVc.isExportVideo) {
539   - if (model.type == TZAssetModelMediaTypeVideo)
  545 + if (CNTZImagePickerVc.isExportVideo) {
  546 + if (model.type == CNTZAssetModelMediaTypeVideo)
540 547 {
541   - model.exportURL = [weakSelf getURLWithModel:model];
  548 + model.exportURL = [weakSelf getURLWithModel:model outputPath:outputPath];
542 549 }
543 550 [selectedModels replaceObjectAtIndex:i withObject:model];
544 551 }
... ... @@ -549,11 +556,11 @@ static CGFloat itemMargin = 5;
549 556 dispatch_sync(queue, ^{
550 557  
551 558 /*** 根据asset取图片 ***/
552   - [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  559 + [[CNTZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
553 560 if (isDegraded) return;
554 561 if (photo) {
555   - if (![TZImagePickerConfig sharedInstance].notScaleImage) {
556   - photo = [[TZImageManager manager] scaleImage:photo toSize:CGSizeMake(tzImagePickerVc.photoWidth, (int)(tzImagePickerVc.photoWidth * photo.size.height / photo.size.width))];
  562 + if (![CNTZImagePickerConfig sharedInstance].notScaleImage) {
  563 + photo = [[CNTZImageManager manager] scaleImage:photo toSize:CGSizeMake(CNTZImagePickerVc.photoWidth, (int)(CNTZImagePickerVc.photoWidth * photo.size.height / photo.size.width))];
557 564 }
558 565 [photos replaceObjectAtIndex:i withObject:photo];
559 566 }
... ... @@ -571,10 +578,10 @@ static CGFloat itemMargin = 5;
571 578 }
572 579 }
573 580  
574   - if (tzImagePickerVc.maxImagesCount == 1 && tzImagePickerVc.allowPickingVideo == NO) {
  581 + if (CNTZImagePickerVc.maxImagesCount == 1 && CNTZImagePickerVc.allowPickingVideo == NO) {
575 582 dispatch_async(dispatch_get_main_queue(), ^{
576   - [tzImagePickerVc hideProgressHUD];
577   - [tzImagePickerVc hideAlertView:alertView];
  583 + [CNTZImagePickerVc hideProgressHUD];
  584 + [CNTZImagePickerVc hideAlertView:alertView];
578 585 });
579 586 [weakSelf didGetAllPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
580 587 return;
... ... @@ -582,8 +589,8 @@ static CGFloat itemMargin = 5;
582 589  
583 590 if (havenotShowAlert) {
584 591 dispatch_async(dispatch_get_main_queue(), ^{
585   - [tzImagePickerVc hideProgressHUD];
586   - [tzImagePickerVc hideAlertView:alertView];
  592 + [CNTZImagePickerVc hideProgressHUD];
  593 + [CNTZImagePickerVc hideAlertView:alertView];
587 594 });
588 595 [weakSelf didGetAllPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
589 596 }
... ... @@ -591,9 +598,9 @@ static CGFloat itemMargin = 5;
591 598 // 如果图片正在从iCloud同步中,提醒用户
592 599 if (progress < 1 && havenotShowAlert && !alertView) {
593 600 dispatch_async(dispatch_get_main_queue(), ^{
594   - [tzImagePickerVc hideProgressHUD];
  601 + [CNTZImagePickerVc hideProgressHUD];
595 602 });
596   - alertView = [tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Synchronizing photos from iCloud"]];
  603 + alertView = [CNTZImagePickerVc showAlertWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Synchronizing photos from iCloud"]];
597 604 havenotShowAlert = NO;
598 605  
599 606 if (self->_isClickDone) {
... ... @@ -615,9 +622,9 @@ static CGFloat itemMargin = 5;
615 622  
616 623  
617 624 /*** 当只有返回Asset 和 没选择时走 ***/
618   - if (tzImagePickerVc.selectedModels.count <= 0 || tzImagePickerVc.onlyReturnAsset) {
  625 + if (CNTZImagePickerVc.selectedModels.count <= 0 || CNTZImagePickerVc.onlyReturnAsset) {
619 626 dispatch_async(dispatch_get_main_queue(), ^{
620   - [tzImagePickerVc hideProgressHUD];
  627 + [CNTZImagePickerVc hideProgressHUD];
621 628 });
622 629  
623 630 [weakSelf didGetAllPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
... ... @@ -633,15 +640,15 @@ static CGFloat itemMargin = 5;
633 640 // NSMutableArray *assets = [NSMutableArray array];
634 641 // NSMutableArray *photos;
635 642 // NSMutableArray *infoArr;
636   -// if (tzImagePickerVc.onlyReturnAsset) { // not fetch image
637   -// for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
638   -// TZAssetModel *model = tzImagePickerVc.selectedModels[i];
  643 +// if (CNTZImagePickerVc.onlyReturnAsset) { // not fetch image
  644 +// for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
  645 +// CNTZAssetModel *model = CNTZImagePickerVc.selectedModels[i];
639 646 // [assets addObject:model.asset];
640 647 // }
641 648 // } else { // fetch image
642 649 // photos = [NSMutableArray array];
643 650 // infoArr = [NSMutableArray array];
644   -// for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
  651 +// for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
645 652 //
646 653 // [selectedModels addObject:@1];
647 654 // [photos addObject:@1];
... ... @@ -651,14 +658,14 @@ static CGFloat itemMargin = 5;
651 658 // }
652 659 //
653 660 // __block BOOL havenotShowAlert = YES;
654   -// [TZImageManager manager].shouldFixOrientation = YES;
  661 +// [CNTZImageManager manager].shouldFixOrientation = YES;
655 662 // __block id alertView;
656   -// for (NSInteger i = 0; i < tzImagePickerVc.selectedModels.count; i++) {
657   -// TZAssetModel *model = tzImagePickerVc.selectedModels[i];
  663 +// for (NSInteger i = 0; i < CNTZImagePickerVc.selectedModels.count; i++) {
  664 +// CNTZAssetModel *model = CNTZImagePickerVc.selectedModels[i];
658 665 //
659 666 // /// 判断是否导出
660   -// if (tzImagePickerVc.isExport) {
661   -// if (model.type == TZAssetModelMediaTypeVideo) {
  667 +// if (CNTZImagePickerVc.isExport) {
  668 +// if (model.type == CNTZAssetModelMediaTypeVideo) {
662 669 // model.exportURL = [self getURLWithModel:model];
663 670 // }
664 671 // [selectedModels replaceObjectAtIndex:i withObject:model];
... ... @@ -666,11 +673,11 @@ static CGFloat itemMargin = 5;
666 673 // [selectedModels replaceObjectAtIndex:i withObject:model];
667 674 // }
668 675 //
669   -// [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  676 +// [[CNTZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
670 677 // if (isDegraded) return;
671 678 // if (photo) {
672   -// if (![TZImagePickerConfig sharedInstance].notScaleImage) {
673   -// photo = [[TZImageManager manager] scaleImage:photo toSize:CGSizeMake(tzImagePickerVc.photoWidth, (int)(tzImagePickerVc.photoWidth * photo.size.height / photo.size.width))];
  679 +// if (![CNTZImagePickerConfig sharedInstance].notScaleImage) {
  680 +// photo = [[CNTZImageManager manager] scaleImage:photo toSize:CGSizeMake(CNTZImagePickerVc.photoWidth, (int)(CNTZImagePickerVc.photoWidth * photo.size.height / photo.size.width))];
674 681 // }
675 682 // [photos replaceObjectAtIndex:i withObject:photo];
676 683 // }
... ... @@ -682,14 +689,14 @@ static CGFloat itemMargin = 5;
682 689 // for (id item in photos) { if ([item isKindOfClass:[NSNumber class]]) return; }
683 690 //
684 691 // if (havenotShowAlert) {
685   -// [tzImagePickerVc hideAlertView:alertView];
  692 +// [CNTZImagePickerVc hideAlertView:alertView];
686 693 // [self didGetAllPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
687 694 // }
688 695 // } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
689 696 // // 如果图片正在从iCloud同步中,提醒用户
690 697 // if (progress < 1 && havenotShowAlert && !alertView) {
691   -// [tzImagePickerVc hideProgressHUD];
692   -// alertView = [tzImagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Synchronizing photos from iCloud"]];
  698 +// [CNTZImagePickerVc hideProgressHUD];
  699 +// alertView = [CNTZImagePickerVc showAlertWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Synchronizing photos from iCloud"]];
693 700 // havenotShowAlert = NO;
694 701 // return;
695 702 // }
... ... @@ -699,28 +706,21 @@ static CGFloat itemMargin = 5;
699 706 // } networkAccessAllowed:YES];
700 707 // }
701 708 // }
702   -// if (tzImagePickerVc.selectedModels.count <= 0 || tzImagePickerVc.onlyReturnAsset) {
  709 +// if (CNTZImagePickerVc.selectedModels.count <= 0 || CNTZImagePickerVc.onlyReturnAsset) {
703 710 // [self didGetAllPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
704 711 // }
705 712 }
706 713  
707 714 /// 导出视频URL
708   -- (NSURL *)getURLWithModel:(TZAssetModel *)model{
  715 +- (NSURL *)getURLWithModel:(CNTZAssetModel *)model outputPath:(NSString *)outputPath{
709 716  
710 717 __block NSURL *returnURL = nil;
711   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  718 +// CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
712 719  
713   - NSString *outputPath = @"";
714   - if ([NSString isEmpty:tzImagePickerVc.conversationId]) {
715   - outputPath = [CNLiveBusinessTools chatFilePathByUserId:CNUserShareModel.uid];
716   - }else{
717   -
718   - outputPath = [CNLiveBusinessTools getChatImageAndVideoUploadIMCacheDirectory];
719   -
720   - }
  720 +
721 721  
722 722 [CNLiveUploadManager zipNewVideoWithAsset:model.asset outputPath:outputPath limitType:AppPhototLimitTypeChat progressCount:^(float progress) {
723   -
  723 + NSLog(@"progress == %f",progress);
724 724 } success:^(NSURL *url) {
725 725 returnURL = url;
726 726 } failure:^{
... ... @@ -758,10 +758,10 @@ static CGFloat itemMargin = 5;
758 758 //}
759 759  
760 760 - (void)didGetAllPhotos:(NSArray *)photos assets:(NSArray *)assets selectedModels:(NSArray *)selectedModels infoArr:(NSArray *)infoArr {
761   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
762   - [tzImagePickerVc hideProgressHUD];
  761 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  762 + [CNTZImagePickerVc hideProgressHUD];
763 763  
764   - if (tzImagePickerVc.autoDismiss) {
  764 + if (CNTZImagePickerVc.autoDismiss) {
765 765 [self.navigationController dismissViewControllerAnimated:YES completion:^{
766 766 [self callDelegateMethodWithPhotos:photos assets:assets selectedModels:selectedModels infoArr:infoArr];
767 767 }];
... ... @@ -772,34 +772,34 @@ static CGFloat itemMargin = 5;
772 772  
773 773 ///lxg:更改
774 774 - (void)callDelegateMethodWithPhotos:(NSArray *)photos assets:(NSArray *)assets selectedModels:(NSArray *)selectedModels infoArr:(NSArray *)infoArr {
775   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
776   - if (tzImagePickerVc.allowPickingVideo && tzImagePickerVc.maxImagesCount == 1) {
777   - if ([[TZImageManager manager] isVideo:[assets firstObject]]) {
778   - if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingVideo:sourceAssets:)]) {
779   - [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingVideo:[photos firstObject] sourceAssets:[assets firstObject]];
  775 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  776 + if (CNTZImagePickerVc.allowPickingVideo && CNTZImagePickerVc.maxImagesCount == 1) {
  777 + if ([[CNTZImageManager manager] isVideo:[assets firstObject]]) {
  778 + if ([CNTZImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingVideo:sourceAssets:)]) {
  779 + [CNTZImagePickerVc.pickerDelegate imagePickerController:CNTZImagePickerVc didFinishPickingVideo:[photos firstObject] sourceAssets:[assets firstObject]];
780 780 }
781   - if (tzImagePickerVc.didFinishPickingVideoHandle) {
782   - tzImagePickerVc.didFinishPickingVideoHandle([photos firstObject], [assets firstObject]);
  781 + if (CNTZImagePickerVc.didFinishPickingVideoHandle) {
  782 + CNTZImagePickerVc.didFinishPickingVideoHandle([photos firstObject], [assets firstObject]);
783 783 }
784 784 return;
785 785 }
786 786 }
787 787  
788   - if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:)]) {
789   - [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto];
  788 + if ([CNTZImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:)]) {
  789 + [CNTZImagePickerVc.pickerDelegate imagePickerController:CNTZImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto];
790 790 }
791   - if ([tzImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:infos:)]) {
792   - [tzImagePickerVc.pickerDelegate imagePickerController:tzImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto infos:infoArr];
  791 + if ([CNTZImagePickerVc.pickerDelegate respondsToSelector:@selector(imagePickerController:didFinishPickingPhotos:sourceAssets:isSelectOriginalPhoto:infos:)]) {
  792 + [CNTZImagePickerVc.pickerDelegate imagePickerController:CNTZImagePickerVc didFinishPickingPhotos:photos sourceAssets:assets isSelectOriginalPhoto:_isSelectOriginalPhoto infos:infoArr];
793 793 }
794   - if (tzImagePickerVc.didFinishPickingPhotosHandle) {
795   - tzImagePickerVc.didFinishPickingPhotosHandle(photos,assets,_isSelectOriginalPhoto);
  794 + if (CNTZImagePickerVc.didFinishPickingPhotosHandle) {
  795 + CNTZImagePickerVc.didFinishPickingPhotosHandle(photos,assets,_isSelectOriginalPhoto);
796 796 }
797   - if (tzImagePickerVc.didFinishPickingPhotosWithInfosHandle) {
798   - tzImagePickerVc.didFinishPickingPhotosWithInfosHandle(photos,assets,_isSelectOriginalPhoto,infoArr);
  797 + if (CNTZImagePickerVc.didFinishPickingPhotosWithInfosHandle) {
  798 + CNTZImagePickerVc.didFinishPickingPhotosWithInfosHandle(photos,assets,_isSelectOriginalPhoto,infoArr);
799 799 }
800 800 #pragma mark - TODO: 导出
801   - if (tzImagePickerVc.didNewFinishPickingPhotosHandle) {
802   - tzImagePickerVc.didNewFinishPickingPhotosHandle(photos, selectedModels, assets, _isSelectOriginalPhoto);
  801 + if (CNTZImagePickerVc.didNewFinishPickingPhotosHandle) {
  802 + CNTZImagePickerVc.didNewFinishPickingPhotosHandle(photos, selectedModels, assets, _isSelectOriginalPhoto);
803 803 }
804 804  
805 805 }
... ... @@ -815,11 +815,11 @@ static CGFloat itemMargin = 5;
815 815  
816 816 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
817 817 // the cell lead to take a picture / 去拍照的cell
818   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
819   - if (((tzImagePickerVc.sortAscendingByModificationDate && indexPath.item >= _models.count) || (!tzImagePickerVc.sortAscendingByModificationDate && indexPath.item == 0)) && _showTakePhotoBtn) {
820   - TZAssetCameraCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZAssetCameraCell" forIndexPath:indexPath];
821   - cell.imageView.image = tzImagePickerVc.takePictureImage;
822   - if ([tzImagePickerVc.takePictureImageName isEqualToString:@"takePicture80"]) {
  818 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  819 + if (((CNTZImagePickerVc.sortAscendingByModificationDate && indexPath.item >= _models.count) || (!CNTZImagePickerVc.sortAscendingByModificationDate && indexPath.item == 0)) && _showTakePhotoBtn) {
  820 + CNTZAssetCameraCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CNTZAssetCameraCell" forIndexPath:indexPath];
  821 + cell.imageView.image = CNTZImagePickerVc.takePictureImage;
  822 + if ([CNTZImagePickerVc.takePictureImageName isEqualToString:@"takePicture80"]) {
823 823 cell.imageView.contentMode = UIViewContentModeCenter;
824 824 CGFloat rgb = 223 / 255.0;
825 825 cell.imageView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
... ... @@ -829,30 +829,30 @@ static CGFloat itemMargin = 5;
829 829 return cell;
830 830 }
831 831 // the cell dipaly photo or video / 展示照片或视频的cell
832   - TZAssetCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZAssetCell" forIndexPath:indexPath];
833   - cell.allowPickingMultipleVideo = tzImagePickerVc.allowPickingMultipleVideo;
834   - cell.photoDefImage = tzImagePickerVc.photoDefImage;
835   - cell.photoSelImage = tzImagePickerVc.photoSelImage;
  832 + CNTZAssetCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"CNTZAssetCell" forIndexPath:indexPath];
  833 + cell.allowPickingMultipleVideo = CNTZImagePickerVc.allowPickingMultipleVideo;
  834 + cell.photoDefImage = CNTZImagePickerVc.photoDefImage;
  835 + cell.photoSelImage = CNTZImagePickerVc.photoSelImage;
836 836 cell.useCachedImage = self.useCachedImage;
837   - cell.assetCellDidSetModelBlock = tzImagePickerVc.assetCellDidSetModelBlock;
838   - cell.assetCellDidLayoutSubviewsBlock = tzImagePickerVc.assetCellDidLayoutSubviewsBlock;
839   - TZAssetModel *model;
840   - if (tzImagePickerVc.sortAscendingByModificationDate || !_showTakePhotoBtn) {
  837 + cell.assetCellDidSetModelBlock = CNTZImagePickerVc.assetCellDidSetModelBlock;
  838 + cell.assetCellDidLayoutSubviewsBlock = CNTZImagePickerVc.assetCellDidLayoutSubviewsBlock;
  839 + CNTZAssetModel *model;
  840 + if (CNTZImagePickerVc.sortAscendingByModificationDate || !_showTakePhotoBtn) {
841 841 model = _models[indexPath.item];
842 842 } else {
843 843 model = _models[indexPath.item - 1];
844 844 }
845   - cell.allowPickingGif = tzImagePickerVc.allowPickingGif;
  845 + cell.allowPickingGif = CNTZImagePickerVc.allowPickingGif;
846 846 cell.model = model;
847   - if (model.isSelected && tzImagePickerVc.showSelectedIndex) {
848   - NSString *assetId = [[TZImageManager manager] getAssetIdentifier:model.asset];
849   - cell.index = [tzImagePickerVc.selectedAssetIds indexOfObject:assetId] + 1;
  847 + if (model.isSelected && CNTZImagePickerVc.showSelectedIndex) {
  848 + NSString *assetId = [[CNTZImageManager manager] getAssetIdentifier:model.asset];
  849 + cell.index = [CNTZImagePickerVc.selectedAssetIds indexOfObject:assetId] + 1;
850 850 }
851   - cell.showSelectBtn = tzImagePickerVc.showSelectBtn;
852   - cell.allowPreview = tzImagePickerVc.allowPreview;
  851 + cell.showSelectBtn = CNTZImagePickerVc.showSelectBtn;
  852 + cell.allowPreview = CNTZImagePickerVc.allowPreview;
853 853  
854   - if (tzImagePickerVc.selectedModels.count >= tzImagePickerVc.maxImagesCount && tzImagePickerVc.showPhotoCannotSelectLayer && !model.isSelected) {
855   - cell.cannotSelectLayerButton.backgroundColor = tzImagePickerVc.cannotSelectLayerColor;
  854 + if (CNTZImagePickerVc.selectedModels.count >= CNTZImagePickerVc.maxImagesCount && CNTZImagePickerVc.showPhotoCannotSelectLayer && !model.isSelected) {
  855 + cell.cannotSelectLayerButton.backgroundColor = CNTZImagePickerVc.cannotSelectLayerColor;
856 856 cell.cannotSelectLayerButton.hidden = NO;
857 857 } else {
858 858 cell.cannotSelectLayerButton.hidden = YES;
... ... @@ -867,31 +867,31 @@ static CGFloat itemMargin = 5;
867 867 __strong typeof(weakLayer) strongLayer = weakLayer;
868 868  
869 869 if (!strongCell.model.isExport) {///lxg:裂图
870   - [tzImagePickerVc showAlertWithTitle:@"图有损坏不可选"];
  870 + [CNTZImagePickerVc showAlertWithTitle:@"图有损坏不可选"];
871 871  
872 872 return;
873 873 }
874 874  
875   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)strongSelf.navigationController;
  875 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)strongSelf.navigationController;
876 876 // 1. cancel select / 取消选择
877 877 if (isSelected) {
878 878 strongCell.selectPhotoButton.selected = NO;
879 879 model.isSelected = NO;
880   - NSArray *selectedModels = [NSArray arrayWithArray:tzImagePickerVc.selectedModels];
881   - for (TZAssetModel *model_item in selectedModels) {
882   - if ([[[TZImageManager manager] getAssetIdentifier:model.asset] isEqualToString:[[TZImageManager manager] getAssetIdentifier:model_item.asset]]) {
883   - [tzImagePickerVc removeSelectedModel:model_item];
  880 + NSArray *selectedModels = [NSArray arrayWithArray:CNTZImagePickerVc.selectedModels];
  881 + for (CNTZAssetModel *model_item in selectedModels) {
  882 + if ([[[CNTZImageManager manager] getAssetIdentifier:model.asset] isEqualToString:[[CNTZImageManager manager] getAssetIdentifier:model_item.asset]]) {
  883 + [CNTZImagePickerVc removeSelectedModel:model_item];
884 884 break;
885 885 }
886 886 }
887 887 [strongSelf refreshBottomToolBarStatus];
888   - if (tzImagePickerVc.showSelectedIndex || tzImagePickerVc.showPhotoCannotSelectLayer) {
  888 + if (CNTZImagePickerVc.showSelectedIndex || CNTZImagePickerVc.showPhotoCannotSelectLayer) {
889 889 [strongSelf setUseCachedImageAndReloadData];
890 890 }
891   - [UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];
  891 + [UIView showOscillatoryAnimationWithLayer:strongLayer type:CNTZOscillatoryAnimationToSmaller];
892 892 } else {
893 893 #pragma mark - 处理iCloud视频
894   - if (weakCell.model.type == TZAssetModelMediaTypeVideo) {
  894 + if (weakCell.model.type == CNTZAssetModelMediaTypeVideo) {
895 895  
896 896 if (weakCell.model.isCheckICloudType) {//检查完成
897 897 if (weakCell.model.isICloudType) {//源是iCloud
... ... @@ -928,7 +928,7 @@ static CGFloat itemMargin = 5;
928 928  
929 929 }];
930 930  
931   - [tzImagePickerVc showAlertWithTitle:@"请进入视频详情加载iCloud视频"];
  931 + [CNTZImagePickerVc showAlertWithTitle:@"请进入视频详情加载iCloud视频"];
932 932 return;
933 933  
934 934 }else {//已下载
... ... @@ -940,14 +940,14 @@ static CGFloat itemMargin = 5;
940 940  
941 941  
942 942 }else {
943   - [tzImagePickerVc showAlertWithTitle:@"请进入视频详情查看iCloud视频"];
  943 + [CNTZImagePickerVc showAlertWithTitle:@"请进入视频详情查看iCloud视频"];
944 944 return;
945 945 }
946 946  
947 947 }
948 948  
949 949 // 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
950   - if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {
  950 + if (CNTZImagePickerVc.selectedModels.count < CNTZImagePickerVc.maxImagesCount) {
951 951 ///lxg禁止选中限制时长视频
952 952 NSTimeInterval duration = 0.0;
953 953 if ([model.asset isKindOfClass:[PHAsset class]]) {
... ... @@ -956,11 +956,11 @@ static CGFloat itemMargin = 5;
956 956 }else if ([model.asset isKindOfClass:[ALAsset class]]){
957 957 duration = [[model.asset valueForProperty:ALAssetPropertyDuration] doubleValue];
958 958 }
959   - if (model.type == TZAssetModelMediaTypeVideo
960   - && tzImagePickerVc.allowPickingMultipleVideo
961   - && duration > tzImagePickerVc.maxVideoDuration) {//视频,支持混选,时长超过最大时长限制
962   - NSInteger minutes = tzImagePickerVc.maxVideoDuration / 60;
963   - NSInteger seconds = tzImagePickerVc.maxVideoDuration % 60;
  959 + if (model.type == CNTZAssetModelMediaTypeVideo
  960 + && CNTZImagePickerVc.allowPickingMultipleVideo
  961 + && duration > CNTZImagePickerVc.maxVideoDuration) {//视频,支持混选,时长超过最大时长限制
  962 + NSInteger minutes = CNTZImagePickerVc.maxVideoDuration / 60;
  963 + NSInteger seconds = CNTZImagePickerVc.maxVideoDuration % 60;
964 964 NSString *timeStr = [NSString string];
965 965 if (minutes == 0) {
966 966 timeStr = [NSString stringWithFormat:@"不能选择超过%li秒视频",(long)seconds];
... ... @@ -969,30 +969,30 @@ static CGFloat itemMargin = 5;
969 969 }else{
970 970 timeStr = [NSString stringWithFormat:@"不能选择超过%li分%li秒视频",(long)minutes,(long)seconds];
971 971 }
972   - [tzImagePickerVc showAlertWithTitle:timeStr];
  972 + [CNTZImagePickerVc showAlertWithTitle:timeStr];
973 973  
974 974 return;
975 975 }
976 976  
977 977  
978   - if (tzImagePickerVc.maxImagesCount == 1 && !tzImagePickerVc.allowPreview) {
  978 + if (CNTZImagePickerVc.maxImagesCount == 1 && !CNTZImagePickerVc.allowPreview) {
979 979 model.isSelected = YES;
980   - [tzImagePickerVc addSelectedModel:model];
  980 + [CNTZImagePickerVc addSelectedModel:model];
981 981 [strongSelf doneButtonClick];
982 982 return;
983 983 }
984 984 strongCell.selectPhotoButton.selected = YES;
985 985 model.isSelected = YES;
986   - if (tzImagePickerVc.showSelectedIndex || tzImagePickerVc.showPhotoCannotSelectLayer) {
  986 + if (CNTZImagePickerVc.showSelectedIndex || CNTZImagePickerVc.showPhotoCannotSelectLayer) {
987 987 model.needOscillatoryAnimation = YES;
988 988 [strongSelf setUseCachedImageAndReloadData];
989 989 }
990   - [tzImagePickerVc addSelectedModel:model];
  990 + [CNTZImagePickerVc addSelectedModel:model];
991 991 [strongSelf refreshBottomToolBarStatus];
992   - [UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];
  992 + [UIView showOscillatoryAnimationWithLayer:strongLayer type:CNTZOscillatoryAnimationToSmaller];
993 993 } else {
994   - NSString *title = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Select a maximum of %zd photos"], tzImagePickerVc.maxImagesCount];
995   - [tzImagePickerVc showAlertWithTitle:title];
  994 + NSString *title = [NSString stringWithFormat:[NSBundle CNTZ_localizedStringForKey:@"Select a maximum of %zd photos"], CNTZImagePickerVc.maxImagesCount];
  995 + [CNTZImagePickerVc showAlertWithTitle:title];
996 996 }
997 997 }
998 998 };
... ... @@ -1002,17 +1002,17 @@ static CGFloat itemMargin = 5;
1002 1002 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
1003 1003  
1004 1004 // take a photo / 去拍照
1005   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  1005 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
1006 1006  
1007   - if (((tzImagePickerVc.sortAscendingByModificationDate && indexPath.item >= _models.count) || (!tzImagePickerVc.sortAscendingByModificationDate && indexPath.item == 0)) && _showTakePhotoBtn) {
  1007 + if (((CNTZImagePickerVc.sortAscendingByModificationDate && indexPath.item >= _models.count) || (!CNTZImagePickerVc.sortAscendingByModificationDate && indexPath.item == 0)) && _showTakePhotoBtn) {
1008 1008 [self takePhoto]; return;
1009 1009 }
1010 1010  
1011 1011 //lxg:损坏
1012   - TZAssetModel *assetModel = _models[indexPath.row];
  1012 + CNTZAssetModel *assetModel = _models[indexPath.row];
1013 1013 if (assetModel) {
1014 1014 if (!assetModel.isExport) {///lxg:裂图
1015   - [tzImagePickerVc showAlertWithTitle:@"图有损坏不可选"];
  1015 + [CNTZImagePickerVc showAlertWithTitle:@"图有损坏不可选"];
1016 1016  
1017 1017 return;
1018 1018 }
... ... @@ -1020,44 +1020,44 @@ static CGFloat itemMargin = 5;
1020 1020  
1021 1021 // preview phote or video / 预览照片或视频
1022 1022 NSInteger index = indexPath.item;
1023   - if (!tzImagePickerVc.sortAscendingByModificationDate && _showTakePhotoBtn) {
  1023 + if (!CNTZImagePickerVc.sortAscendingByModificationDate && _showTakePhotoBtn) {
1024 1024 index = indexPath.item - 1;
1025 1025 }
1026   -// TZAssetModel *model = _models[index];
  1026 +// CNTZAssetModel *model = _models[index];
1027 1027  
1028 1028 #pragma mark - 聊天里面进入和朋友圈中进入LXG
1029 1029  
1030   - TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
  1030 + CNTZPhotoPreviewController *photoPreviewVc = [[CNTZPhotoPreviewController alloc] init];
1031 1031 photoPreviewVc.enterType = PhotoPreviewEnterTypeNormal;
1032 1032 photoPreviewVc.currentIndex = index;
1033 1033 photoPreviewVc.models = _models;
1034   - photoPreviewVc.isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto;
  1034 + photoPreviewVc.isSelectOriginalPhoto = CNTZImagePickerVc.isSelectOriginalPhoto;
1035 1035 [self pushPhotoPrevireViewController:photoPreviewVc];
1036 1036  
1037 1037  
1038 1038 // ///LXG进行 注释
1039   -// if (model.type == TZAssetModelMediaTypeVideo && !tzImagePickerVc.allowPickingMultipleVideo) {///支持混选+点击视频
1040   -// if (tzImagePickerVc.selectedModels.count > 0) {
1041   -// TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
1042   -// [imagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Can not choose both video and photo"]];
  1039 +// if (model.type == CNTZAssetModelMediaTypeVideo && !CNTZImagePickerVc.allowPickingMultipleVideo) {///支持混选+点击视频
  1040 +// if (CNTZImagePickerVc.selectedModels.count > 0) {
  1041 +// CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
  1042 +// [imagePickerVc showAlertWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Can not choose both video and photo"]];
1043 1043 // } else {
1044   -// TZVideoPlayerController *videoPlayerVc = [[TZVideoPlayerController alloc] init];
  1044 +// CNTZVideoPlayerController *videoPlayerVc = [[CNTZVideoPlayerController alloc] init];
1045 1045 // videoPlayerVc.model = model;
1046 1046 // videoPlayerVc.isOther = NO;//相册内部进入(LXG)
1047 1047 // [self.navigationController pushViewController:videoPlayerVc animated:YES];
1048 1048 // }
1049   -// } else if (model.type == TZAssetModelMediaTypePhotoGif && tzImagePickerVc.allowPickingGif && !tzImagePickerVc.allowPickingMultipleVideo) {//支持混选+GIF
1050   -// if (tzImagePickerVc.selectedModels.count > 0) {
1051   -// TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
1052   -// [imagePickerVc showAlertWithTitle:[NSBundle tz_localizedStringForKey:@"Can not choose both photo and GIF"]];
  1049 +// } else if (model.type == CNTZAssetModelMediaTypePhotoGif && CNTZImagePickerVc.allowPickingGif && !CNTZImagePickerVc.allowPickingMultipleVideo) {//支持混选+GIF
  1050 +// if (CNTZImagePickerVc.selectedModels.count > 0) {
  1051 +// CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
  1052 +// [imagePickerVc showAlertWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Can not choose both photo and GIF"]];
1053 1053 // } else {
1054   -// TZGifPhotoPreviewController *gifPreviewVc = [[TZGifPhotoPreviewController alloc] init];
  1054 +// CNTZGifPhotoPreviewController *gifPreviewVc = [[CNTZGifPhotoPreviewController alloc] init];
1055 1055 // gifPreviewVc.model = model;
1056 1056 // [self.navigationController pushViewController:gifPreviewVc animated:YES];
1057 1057 // }
1058 1058 // } else {
1059 1059 //#pragma mark - 当可以混选
1060   -// TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
  1060 +// CNTZPhotoPreviewController *photoPreviewVc = [[CNTZPhotoPreviewController alloc] init];
1061 1061 // photoPreviewVc.currentIndex = index;
1062 1062 // photoPreviewVc.models = _models;
1063 1063 // [self pushPhotoPrevireViewController:photoPreviewVc];
... ... @@ -1087,17 +1087,17 @@ static CGFloat itemMargin = 5;
1087 1087 AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
1088 1088 if ((authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied) && iOS7Later) {
1089 1089  
1090   - NSDictionary *infoDict = [TZCommonTools tz_getInfoDictionary];
  1090 + NSDictionary *infoDict = [CNTZCommonTools CNTZ_getInfoDictionary];
1091 1091 // 无权限 做一个友好的提示
1092 1092 NSString *appName = [infoDict valueForKey:@"CFBundleDisplayName"];
1093 1093 if (!appName) appName = [infoDict valueForKey:@"CFBundleName"];
1094 1094  
1095   - NSString *message = [NSString stringWithFormat:[NSBundle tz_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName];
  1095 + NSString *message = [NSString stringWithFormat:[NSBundle CNTZ_localizedStringForKey:@"Please allow %@ to access your camera in \"Settings -> Privacy -> Camera\""],appName];
1096 1096 if (iOS8Later) {
1097   - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"Cancel"] otherButtonTitles:[NSBundle tz_localizedStringForKey:@"Setting"], nil];
  1097 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle CNTZ_localizedStringForKey:@"Cancel"] otherButtonTitles:[NSBundle CNTZ_localizedStringForKey:@"Setting"], nil];
1098 1098 [alert show];
1099 1099 } else {
1100   - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle tz_localizedStringForKey:@"OK"] otherButtonTitles:nil];
  1100 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSBundle CNTZ_localizedStringForKey:@"Can not use camera"] message:message delegate:self cancelButtonTitle:[NSBundle CNTZ_localizedStringForKey:@"OK"] otherButtonTitles:nil];
1101 1101 [alert show];
1102 1102 }
1103 1103 } else if (authStatus == AVAuthorizationStatusNotDetermined) {
... ... @@ -1121,10 +1121,10 @@ static CGFloat itemMargin = 5;
1121 1121 // 调用相机
1122 1122 - (void)pushImagePickerController {
1123 1123 // 提前定位
1124   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
1125   - if (tzImagePickerVc.allowCameraLocation) {
  1124 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  1125 + if (CNTZImagePickerVc.allowCameraLocation) {
1126 1126 __weak typeof(self) weakSelf = self;
1127   - [[TZLocationManager manager] startLocationWithSuccessBlock:^(NSArray<CLLocation *> *locations) {
  1127 + [[CNTZLocationManager manager] startLocationWithSuccessBlock:^(NSArray<CLLocation *> *locations) {
1128 1128 __strong typeof(weakSelf) strongSelf = weakSelf;
1129 1129 strongSelf.location = [locations firstObject];
1130 1130 } failureBlock:^(NSError *error) {
... ... @@ -1137,19 +1137,19 @@ static CGFloat itemMargin = 5;
1137 1137 if ([UIImagePickerController isSourceTypeAvailable: sourceType]) {
1138 1138 self.imagePickerVc.sourceType = sourceType;
1139 1139 NSMutableArray *mediaTypes = [NSMutableArray array];
1140   - if (tzImagePickerVc.allowTakePicture) {
  1140 + if (CNTZImagePickerVc.allowTakePicture) {
1141 1141 [mediaTypes addObject:(NSString *)kUTTypeImage];
1142 1142 }
1143   - if (tzImagePickerVc.allowTakeVideo) {
  1143 + if (CNTZImagePickerVc.allowTakeVideo) {
1144 1144 [mediaTypes addObject:(NSString *)kUTTypeMovie];
1145   - self.imagePickerVc.videoMaximumDuration = tzImagePickerVc.videoMaximumDuration;
  1145 + self.imagePickerVc.videoMaximumDuration = CNTZImagePickerVc.videoMaximumDuration;
1146 1146 }
1147 1147 self.imagePickerVc.mediaTypes= mediaTypes;
1148 1148 if (iOS8Later) {
1149 1149 _imagePickerVc.modalPresentationStyle = UIModalPresentationOverCurrentContext;
1150 1150 }
1151   - if (tzImagePickerVc.uiImagePickerControllerSettingBlock) {
1152   - tzImagePickerVc.uiImagePickerControllerSettingBlock(_imagePickerVc);
  1151 + if (CNTZImagePickerVc.uiImagePickerControllerSettingBlock) {
  1152 + CNTZImagePickerVc.uiImagePickerControllerSettingBlock(_imagePickerVc);
1153 1153 }
1154 1154 [self presentViewController:_imagePickerVc animated:YES completion:nil];
1155 1155 } else {
... ... @@ -1158,31 +1158,31 @@ static CGFloat itemMargin = 5;
1158 1158 }
1159 1159  
1160 1160 - (void)refreshBottomToolBarStatus {
1161   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  1161 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
1162 1162  
1163   - _previewButton.enabled = tzImagePickerVc.selectedModels.count > 0;
1164   - _doneButton.enabled = tzImagePickerVc.selectedModels.count > 0 || tzImagePickerVc.alwaysEnableDoneBtn;
  1163 + _previewButton.enabled = CNTZImagePickerVc.selectedModels.count > 0;
  1164 + _doneButton.enabled = CNTZImagePickerVc.selectedModels.count > 0 || CNTZImagePickerVc.alwaysEnableDoneBtn;
1165 1165  
1166   - _numberImageView.hidden = tzImagePickerVc.selectedModels.count <= 0;
1167   - _numberLabel.hidden = tzImagePickerVc.selectedModels.count <= 0;
1168   - _numberLabel.text = [NSString stringWithFormat:@"%zd",tzImagePickerVc.selectedModels.count];
  1166 + _numberImageView.hidden = CNTZImagePickerVc.selectedModels.count <= 0;
  1167 + _numberLabel.hidden = CNTZImagePickerVc.selectedModels.count <= 0;
  1168 + _numberLabel.text = [NSString stringWithFormat:@"%zd",CNTZImagePickerVc.selectedModels.count];
1169 1169 #pragma mark - 添加: 选择图片个数显示(LXG)
1170 1170 _numberImageView.hidden = YES;
1171 1171 _numberLabel.hidden = YES;
1172   - [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",tzImagePickerVc.selectedModels.count] forState:UIControlStateNormal];
  1172 + [_doneButton setTitle:[NSString stringWithFormat:@"完成(%zd)",CNTZImagePickerVc.selectedModels.count] forState:UIControlStateNormal];
1173 1173  
1174   - _originalPhotoButton.enabled = tzImagePickerVc.selectedModels.count > 0;
  1174 + _originalPhotoButton.enabled = CNTZImagePickerVc.selectedModels.count > 0;
1175 1175 _originalPhotoButton.selected = (_isSelectOriginalPhoto && _originalPhotoButton.enabled);
1176 1176 _originalPhotoLabel.hidden = YES;///lxg添加
1177 1177 // _originalPhotoLabel.hidden = (!_originalPhotoButton.isSelected);///lxg注释
1178 1178 if (_isSelectOriginalPhoto) [self getSelectedPhotoBytes];
1179 1179 }
1180 1180  
1181   -- (void)pushPhotoPrevireViewController:(TZPhotoPreviewController *)photoPreviewVc {
  1181 +- (void)pushPhotoPrevireViewController:(CNTZPhotoPreviewController *)photoPreviewVc {
1182 1182 [self pushPhotoPrevireViewController:photoPreviewVc needCheckSelectedModels:NO];
1183 1183 }
1184 1184  
1185   -- (void)pushPhotoPrevireViewController:(TZPhotoPreviewController *)photoPreviewVc needCheckSelectedModels:(BOOL)needCheckSelectedModels {
  1185 +- (void)pushPhotoPrevireViewController:(CNTZPhotoPreviewController *)photoPreviewVc needCheckSelectedModels:(BOOL)needCheckSelectedModels {
1186 1186 __weak typeof(self) weakSelf = self;
1187 1187 photoPreviewVc.isSelectOriginalPhoto = _isSelectOriginalPhoto;
1188 1188 [photoPreviewVc setBackButtonClickBlock:^(BOOL isSelectOriginalPhoto) {
... ... @@ -1210,21 +1210,21 @@ static CGFloat itemMargin = 5;
1210 1210  
1211 1211 - (void)getSelectedPhotoBytes {
1212 1212 // 越南语 && 5屏幕时会显示不下,暂时这样处理
1213   - if ([[TZImagePickerConfig sharedInstance].preferredLanguage isEqualToString:@"vi"] && self.view.tz_width <= 320) {
  1213 + if ([[CNTZImagePickerConfig sharedInstance].preferredLanguage isEqualToString:@"vi"] && self.view.CNTZ_width <= 320) {
1214 1214 return;
1215 1215 }
1216   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
1217   - [[TZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) {
  1216 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
  1217 + [[CNTZImageManager manager] getPhotosBytesWithArray:imagePickerVc.selectedModels completion:^(NSString *totalBytes) {
1218 1218 self->_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
1219 1219 self->_originalPhotoLabel.hidden = YES;///lxg添加
1220 1220 }];
1221 1221 }
1222 1222  
1223 1223 - (void)scrollCollectionViewToBottom {
1224   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  1224 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
1225 1225 if (_shouldScrollToBottom && _models.count > 0) {
1226 1226 NSInteger item = 0;
1227   - if (tzImagePickerVc.sortAscendingByModificationDate) {
  1227 + if (CNTZImagePickerVc.sortAscendingByModificationDate) {
1228 1228 item = _models.count - 1;
1229 1229 if (_showTakePhotoBtn) {
1230 1230 item += 1;
... ... @@ -1244,41 +1244,41 @@ static CGFloat itemMargin = 5;
1244 1244 - (void)checkSelectedModels {
1245 1245 NSMutableArray *selectedAssets = [NSMutableArray array];
1246 1246  
1247   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
  1247 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
1248 1248  
1249   - [tzImagePickerVc.selectedModels enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(TZAssetModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  1249 + [CNTZImagePickerVc.selectedModels enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(CNTZAssetModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
1250 1250  
1251 1251 /*** 筛选损坏视频 ***/
1252   - if (obj.type == TZAssetModelMediaTypeVideo) {
  1252 + if (obj.type == CNTZAssetModelMediaTypeVideo) {
1253 1253 NSURL *url = [obj.asset movieURL];
1254 1254 if (!url) {
1255   - [tzImagePickerVc removeSelectedModel:obj];
  1255 + [CNTZImagePickerVc removeSelectedModel:obj];
1256 1256 NSString *imgShowStr = [NSString stringWithFormat:@"选择中第%ld已损坏,已删除",(idx + 1)];
1257   - [tzImagePickerVc showAlertWithTitle:imgShowStr];
  1257 + [CNTZImagePickerVc showAlertWithTitle:imgShowStr];
1258 1258  
1259 1259 }
1260 1260 }
1261 1261 /*** 筛选损坏图片 ***/
1262   - if (obj.type == TZAssetModelMediaTypePhotoGif
1263   - || obj.type == TZAssetModelMediaTypePhoto) {
  1262 + if (obj.type == CNTZAssetModelMediaTypePhotoGif
  1263 + || obj.type == CNTZAssetModelMediaTypePhoto) {
1264 1264  
1265 1265 UIImage *photo = [obj.asset getPhoto];
1266 1266 if (!photo) {
1267   - [tzImagePickerVc removeSelectedModel:obj];
  1267 + [CNTZImagePickerVc removeSelectedModel:obj];
1268 1268 NSString *imgShowStr = [NSString stringWithFormat:@"选择中第%ld已损坏,已删除",(idx + 1)];
1269   - [tzImagePickerVc showAlertWithTitle:imgShowStr];
  1269 + [CNTZImagePickerVc showAlertWithTitle:imgShowStr];
1270 1270 }
1271 1271  
1272 1272 }
1273 1273  
1274 1274 }];
1275 1275  
1276   - for (TZAssetModel *model in tzImagePickerVc.selectedModels) {
  1276 + for (CNTZAssetModel *model in CNTZImagePickerVc.selectedModels) {
1277 1277 [selectedAssets addObject:model.asset];
1278 1278 }
1279   - for (TZAssetModel *model in _models) {
  1279 + for (CNTZAssetModel *model in _models) {
1280 1280 model.isSelected = NO;
1281   - if ([[TZImageManager manager] isAssetsArray:selectedAssets containAsset:model.asset]) {
  1281 + if ([[CNTZImageManager manager] isAssetsArray:selectedAssets containAsset:model.asset]) {
1282 1282 model.isSelected = YES;
1283 1283 }
1284 1284 }
... ... @@ -1301,11 +1301,11 @@ static CGFloat itemMargin = 5;
1301 1301 [picker dismissViewControllerAnimated:YES completion:nil];
1302 1302 NSString *type = [info objectForKey:UIImagePickerControllerMediaType];
1303 1303 if ([type isEqualToString:@"public.image"]) {
1304   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  1304 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
1305 1305 [imagePickerVc showProgressHUD];
1306 1306 UIImage *photo = [info objectForKey:UIImagePickerControllerOriginalImage];
1307 1307 if (photo) {
1308   - [[TZImageManager manager] savePhotoWithImage:photo location:self.location completion:^(NSError *error){
  1308 + [[CNTZImageManager manager] savePhotoWithImage:photo location:self.location completion:^(NSError *error){
1309 1309 if (!error) {
1310 1310 [self reloadPhotoArrayWithMediaType:type];
1311 1311 }
... ... @@ -1313,11 +1313,11 @@ static CGFloat itemMargin = 5;
1313 1313 self.location = nil;
1314 1314 }
1315 1315 } else if ([type isEqualToString:@"public.movie"]) {
1316   - TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
  1316 + CNTZImagePickerController *imagePickerVc = (CNTZImagePickerController *)self.navigationController;
1317 1317 [imagePickerVc showProgressHUD];
1318 1318 NSURL *videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
1319 1319 if (videoUrl) {
1320   - [[TZImageManager manager] saveVideoWithUrl:videoUrl location:self.location completion:^(NSError *error) {
  1320 + [[CNTZImageManager manager] saveVideoWithUrl:videoUrl location:self.location completion:^(NSError *error) {
1321 1321 if (!error) {
1322 1322 [self reloadPhotoArrayWithMediaType:type];
1323 1323 }
... ... @@ -1328,14 +1328,14 @@ static CGFloat itemMargin = 5;
1328 1328 }
1329 1329  
1330 1330 - (void)reloadPhotoArrayWithMediaType:(NSString *)mediaType {
1331   - TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
1332   - [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) {
  1331 + CNTZImagePickerController *CNTZImagePickerVc = (CNTZImagePickerController *)self.navigationController;
  1332 + [[CNTZImageManager manager] getCameraRollAlbum:CNTZImagePickerVc.allowPickingVideo allowPickingImage:CNTZImagePickerVc.allowPickingImage needFetchAssets:NO completion:^(CNTZAlbumModel *model) {
1333 1333 self->_model = model;
1334   - [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {
1335   - [tzImagePickerVc hideProgressHUD];
  1334 + [[CNTZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<CNTZAssetModel *> *models) {
  1335 + [CNTZImagePickerVc hideProgressHUD];
1336 1336  
1337   - TZAssetModel *assetModel;
1338   - if (tzImagePickerVc.sortAscendingByModificationDate) {
  1337 + CNTZAssetModel *assetModel;
  1338 + if (CNTZImagePickerVc.sortAscendingByModificationDate) {
1339 1339 assetModel = [models lastObject];
1340 1340 [self->_models addObject:assetModel];
1341 1341 } else {
... ... @@ -1343,10 +1343,10 @@ static CGFloat itemMargin = 5;
1343 1343 [self->_models insertObject:assetModel atIndex:0];
1344 1344 }
1345 1345  
1346   - if (tzImagePickerVc.maxImagesCount <= 1) {
1347   - if (tzImagePickerVc.allowCrop) {
1348   - TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
1349   - if (tzImagePickerVc.sortAscendingByModificationDate) {
  1346 + if (CNTZImagePickerVc.maxImagesCount <= 1) {
  1347 + if (CNTZImagePickerVc.allowCrop) {
  1348 + CNTZPhotoPreviewController *photoPreviewVc = [[CNTZPhotoPreviewController alloc] init];
  1349 + if (CNTZImagePickerVc.sortAscendingByModificationDate) {
1350 1350 photoPreviewVc.currentIndex = self->_models.count - 1;
1351 1351 } else {
1352 1352 photoPreviewVc.currentIndex = 0;
... ... @@ -1354,18 +1354,18 @@ static CGFloat itemMargin = 5;
1354 1354 photoPreviewVc.models = self->_models;
1355 1355 [self pushPhotoPrevireViewController:photoPreviewVc];
1356 1356 } else {
1357   - [tzImagePickerVc addSelectedModel:assetModel];
  1357 + [CNTZImagePickerVc addSelectedModel:assetModel];
1358 1358 [self doneButtonClick];
1359 1359 }
1360 1360 return;
1361 1361 }
1362 1362  
1363   - if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {
1364   - if ([mediaType isEqualToString:@"public.movie"] && !tzImagePickerVc.allowPickingMultipleVideo) {
  1363 + if (CNTZImagePickerVc.selectedModels.count < CNTZImagePickerVc.maxImagesCount) {
  1364 + if ([mediaType isEqualToString:@"public.movie"] && !CNTZImagePickerVc.allowPickingMultipleVideo) {
1365 1365 // 不能多选视频的情况下,不选中拍摄的视频
1366 1366 } else {
1367 1367 assetModel.isSelected = YES;
1368   - [tzImagePickerVc addSelectedModel:assetModel];
  1368 + [CNTZImagePickerVc addSelectedModel:assetModel];
1369 1369 [self refreshBottomToolBarStatus];
1370 1370 }
1371 1371 }
... ... @@ -1384,13 +1384,13 @@ static CGFloat itemMargin = 5;
1384 1384  
1385 1385 - (void)dealloc {
1386 1386 // NSLog(@"%@ dealloc",NSStringFromClass(self.class));
1387   - NSLog(@"相册_相册_TZPhotoPickerController_dealloc");
  1387 + NSLog(@"相册_相册_CNTZPhotoPickerController_dealloc");
1388 1388 }
1389 1389  
1390 1390 #pragma mark - Asset Caching
1391 1391  
1392 1392 - (void)resetCachedAssets {
1393   - [[TZImageManager manager].cachingImageManager stopCachingImagesForAllAssets];
  1393 + [[CNTZImageManager manager].cachingImageManager stopCachingImagesForAllAssets];
1394 1394 self.previousPreheatRect = CGRectZero;
1395 1395 }
1396 1396  
... ... @@ -1425,11 +1425,11 @@ static CGFloat itemMargin = 5;
1425 1425 NSArray *assetsToStopCaching = [self assetsAtIndexPaths:removedIndexPaths];
1426 1426  
1427 1427 // Update the assets the PHCachingImageManager is caching.
1428   - [[TZImageManager manager].cachingImageManager startCachingImagesForAssets:assetsToStartCaching
  1428 + [[CNTZImageManager manager].cachingImageManager startCachingImagesForAssets:assetsToStartCaching
1429 1429 targetSize:AssetGridThumbnailSize
1430 1430 contentMode:PHImageContentModeAspectFill
1431 1431 options:nil];
1432   - [[TZImageManager manager].cachingImageManager stopCachingImagesForAssets:assetsToStopCaching
  1432 + [[CNTZImageManager manager].cachingImageManager stopCachingImagesForAssets:assetsToStopCaching
1433 1433 targetSize:AssetGridThumbnailSize
1434 1434 contentMode:PHImageContentModeAspectFill
1435 1435 options:nil];
... ... @@ -1477,7 +1477,7 @@ static CGFloat itemMargin = 5;
1477 1477 NSMutableArray *assets = [NSMutableArray arrayWithCapacity:indexPaths.count];
1478 1478 for (NSIndexPath *indexPath in indexPaths) {
1479 1479 if (indexPath.item < _models.count) {
1480   - TZAssetModel *model = _models[indexPath.item];
  1480 + CNTZAssetModel *model = _models[indexPath.item];
1481 1481 [assets addObject:model.asset];
1482 1482 }
1483 1483 }
... ... @@ -1501,7 +1501,7 @@ static CGFloat itemMargin = 5;
1501 1501  
1502 1502  
1503 1503  
1504   -@implementation TZCollectionView
  1504 +@implementation CNTZCollectionView
1505 1505  
1506 1506 - (BOOL)touchesShouldCancelInContentView:(UIView *)view {
1507 1507 if ([view isKindOfClass:[UIControl class]]) {
... ...
CNLiveImagePickerController/Classes/TZPhotoPreviewCell.h renamed to CNLiveImagePickerController/Classes/CNTZPhotoPreviewCell.h
1 1 //
2   -// TZPhotoPreviewCell.h
3   -// TZImagePickerController
  2 +// CNTZPhotoPreviewCell.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
... ... @@ -8,21 +8,21 @@
8 8  
9 9 #import <UIKit/UIKit.h>
10 10  
11   -@class TZAssetModel;
12   -@interface TZAssetPreviewCell : UICollectionViewCell
13   -@property (nonatomic, strong) TZAssetModel *model;
  11 +@class CNTZAssetModel;
  12 +@interface CNTZAssetPreviewCell : UICollectionViewCell
  13 +@property (nonatomic, strong) CNTZAssetModel *model;
14 14 @property (nonatomic, copy) void (^singleTapGestureBlock)(void);
15 15 - (void)configSubviews;
16 16 - (void)photoPreviewCollectionViewDidScroll;
17 17 @end
18 18  
19 19  
20   -@class TZAssetModel,TZProgressView,TZPhotoPreviewView;
21   -@interface TZPhotoPreviewCell : TZAssetPreviewCell
  20 +@class CNTZAssetModel,CNTZProgressView,CNTZPhotoPreviewView;
  21 +@interface CNTZPhotoPreviewCell : CNTZAssetPreviewCell
22 22  
23 23 @property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);
24 24  
25   -@property (nonatomic, strong) TZPhotoPreviewView *previewView;
  25 +@property (nonatomic, strong) CNTZPhotoPreviewView *previewView;
26 26  
27 27 @property (nonatomic, assign) BOOL allowCrop;
28 28 @property (nonatomic, assign) CGRect cropRect;
... ... @@ -32,16 +32,16 @@
32 32 @end
33 33  
34 34  
35   -@interface TZPhotoPreviewView : UIView
  35 +@interface CNTZPhotoPreviewView : UIView
36 36 @property (nonatomic, strong) UIImageView *imageView;
37 37 @property (nonatomic, strong) UIScrollView *scrollView;
38 38 @property (nonatomic, strong) UIView *imageContainerView;
39   -@property (nonatomic, strong) TZProgressView *progressView;
  39 +@property (nonatomic, strong) CNTZProgressView *progressView;
40 40  
41 41 @property (nonatomic, assign) BOOL allowCrop;
42 42 @property (nonatomic, assign) CGRect cropRect;
43 43  
44   -@property (nonatomic, strong) TZAssetModel *model;
  44 +@property (nonatomic, strong) CNTZAssetModel *model;
45 45 @property (nonatomic, strong) id asset;
46 46 @property (nonatomic, copy) void (^singleTapGestureBlock)(void);
47 47 @property (nonatomic, copy) void (^imageProgressUpdateBlock)(double progress);
... ... @@ -53,19 +53,19 @@
53 53  
54 54  
55 55 @class AVPlayer, AVPlayerLayer;
56   -@interface TZVideoPreviewCell : TZAssetPreviewCell
  56 +@interface CNTZVideoPreviewCell : CNTZAssetPreviewCell
57 57 @property (strong, nonatomic) AVPlayer *player;
58 58 @property (strong, nonatomic) AVPlayerLayer *playerLayer;
59 59 @property (strong, nonatomic) UIButton *playButton;
60 60 @property (strong, nonatomic) UIImage *cover;
61 61  
62   -@property (nonatomic, strong) TZProgressView *progressView;
63   -@property (nonatomic, copy) void (^imageProgressUpdateBlock)(TZVideoPreviewCell *cell);
  62 +@property (nonatomic, strong) CNTZProgressView *progressView;
  63 +@property (nonatomic, copy) void (^imageProgressUpdateBlock)(CNTZVideoPreviewCell *cell);
64 64  
65 65 - (void)pausePlayerAndShowNaviBar;
66 66 @end
67 67  
68 68  
69   -@interface TZGifPreviewCell : TZAssetPreviewCell
70   -@property (strong, nonatomic) TZPhotoPreviewView *previewView;
  69 +@interface CNTZGifPreviewCell : CNTZAssetPreviewCell
  70 +@property (strong, nonatomic) CNTZPhotoPreviewView *previewView;
71 71 @end
... ...
CNLiveImagePickerController/Classes/TZPhotoPreviewCell.m renamed to CNLiveImagePickerController/Classes/CNTZPhotoPreviewCell.m
1 1 //
2   -// TZPhotoPreviewCell.m
3   -// TZImagePickerController
  2 +// CNTZPhotoPreviewCell.m
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
7 7 //
8 8  
9   -#import "TZPhotoPreviewCell.h"
10   -#import "TZAssetModel.h"
11   -#import "UIView+TZLayout.h"
12   -#import "TZImageManager.h"
13   -#import "TZProgressView.h"
14   -#import "TZImageCropManager.h"
  9 +#import "CNTZPhotoPreviewCell.h"
  10 +#import "CNTZAssetModel.h"
  11 +#import "UIView+CNTZLayout.h"
  12 +#import "CNTZImageManager.h"
  13 +#import "CNTZProgressView.h"
  14 +#import "CNTZImageCropManager.h"
15 15 #import <MediaPlayer/MediaPlayer.h>
16   -#import "TZImagePickerController.h"
  16 +#import "CNTZImagePickerController.h"
17 17  
18 18 #pragma mark - TODO: 2019.11.12 需要其他库依赖
19 19 //#import "CNAudioOrVideoMananger.h"
20 20 //#import "CNLiveSoundManager.h"
21 21 ////////////////////////
22   -@implementation TZAssetPreviewCell
  22 +@implementation CNTZAssetPreviewCell
23 23  
24 24 - (instancetype)initWithFrame:(CGRect)frame {
25 25 self = [super initWithFrame:frame];
... ... @@ -54,10 +54,10 @@
54 54 @end
55 55  
56 56  
57   -@implementation TZPhotoPreviewCell
  57 +@implementation CNTZPhotoPreviewCell
58 58  
59 59 - (void)configSubviews {
60   - self.previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];
  60 + self.previewView = [[CNTZPhotoPreviewView alloc] initWithFrame:CGRectZero];
61 61 __weak typeof(self) weakSelf = self;
62 62 [self.previewView setSingleTapGestureBlock:^{
63 63 __strong typeof(weakSelf) strongSelf = weakSelf;
... ... @@ -74,7 +74,7 @@
74 74 [self addSubview:self.previewView];
75 75 }
76 76  
77   -- (void)setModel:(TZAssetModel *)model {
  77 +- (void)setModel:(CNTZAssetModel *)model {
78 78 [super setModel:model];
79 79 _previewView.asset = model.asset;
80 80 }
... ... @@ -101,11 +101,11 @@
101 101 @end
102 102  
103 103  
104   -@interface TZPhotoPreviewView ()<UIScrollViewDelegate>
  104 +@interface CNTZPhotoPreviewView ()<UIScrollViewDelegate>
105 105 @property (assign, nonatomic) BOOL isRequestingGIF;
106 106 @end
107 107  
108   -@implementation TZPhotoPreviewView
  108 +@implementation CNTZPhotoPreviewView
109 109  
110 110 - (instancetype)initWithFrame:(CGRect)frame {
111 111 self = [super initWithFrame:frame];
... ... @@ -152,18 +152,18 @@
152 152 }
153 153  
154 154 - (void)configProgressView {
155   - _progressView = [[TZProgressView alloc] init];
  155 + _progressView = [[CNTZProgressView alloc] init];
156 156 _progressView.hidden = YES;
157 157 [self addSubview:_progressView];
158 158 }
159 159  
160   -- (void)setModel:(TZAssetModel *)model {
  160 +- (void)setModel:(CNTZAssetModel *)model {
161 161 _model = model;
162 162 self.isRequestingGIF = NO;
163 163 [_scrollView setZoomScale:1.0 animated:NO];
164   - if (model.type == TZAssetModelMediaTypePhotoGif) {
  164 + if (model.type == CNTZAssetModelMediaTypePhotoGif) {
165 165 // 先显示缩略图
166   - [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  166 + [[CNTZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
167 167 self.imageView.image = photo;
168 168 [self resizeSubviews];
169 169 if (self.isRequestingGIF) {
... ... @@ -171,7 +171,7 @@
171 171 }
172 172 // 再显示gif动图
173 173 self.isRequestingGIF = YES;
174   - [[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
  174 + [[CNTZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
175 175 progress = progress > 0.02 ? progress : 0.02;
176 176 dispatch_async(dispatch_get_main_queue(), ^{
177 177 self.progressView.progress = progress;
... ... @@ -182,13 +182,13 @@
182 182 }
183 183 });
184 184 #ifdef DEBUG
185   - NSLog(@"[TZImagePickerController] getOriginalPhotoDataWithAsset:%f error:%@", progress, error);
  185 + NSLog(@"[CNTZImagePickerController] getOriginalPhotoDataWithAsset:%f error:%@", progress, error);
186 186 #endif
187 187 } completion:^(NSData *data, NSDictionary *info, BOOL isDegraded) {
188 188 if (!isDegraded) {
189 189 self.isRequestingGIF = NO;
190 190 self.progressView.hidden = YES;
191   - self.imageView.image = [UIImage sd_tz_animatedGIFWithData:data];
  191 + self.imageView.image = [UIImage sd_CNTZ_animatedGIFWithData:data];
192 192 [self resizeSubviews];
193 193 }
194 194 }];
... ... @@ -204,7 +204,7 @@
204 204 }
205 205  
206 206 _asset = asset;
207   - self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  207 + self.imageRequestID = [[CNTZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
208 208 if (![asset isEqual:self->_asset]) return;
209 209 self.imageView.image = photo;
210 210 [self resizeSubviews];
... ... @@ -238,26 +238,26 @@
238 238 }
239 239  
240 240 - (void)resizeSubviews {
241   - _imageContainerView.tz_origin = CGPointZero;
242   - _imageContainerView.tz_width = self.scrollView.tz_width;
  241 + _imageContainerView.CNTZ_origin = CGPointZero;
  242 + _imageContainerView.CNTZ_width = self.scrollView.CNTZ_width;
243 243  
244 244 UIImage *image = _imageView.image;
245   - if (image.size.height / image.size.width > self.tz_height / self.scrollView.tz_width) {
246   - _imageContainerView.tz_height = floor(image.size.height / (image.size.width / self.scrollView.tz_width));
  245 + if (image.size.height / image.size.width > self.CNTZ_height / self.scrollView.CNTZ_width) {
  246 + _imageContainerView.CNTZ_height = floor(image.size.height / (image.size.width / self.scrollView.CNTZ_width));
247 247 } else {
248   - CGFloat height = image.size.height / image.size.width * self.scrollView.tz_width;
249   - if (height < 1 || isnan(height)) height = self.tz_height;
  248 + CGFloat height = image.size.height / image.size.width * self.scrollView.CNTZ_width;
  249 + if (height < 1 || isnan(height)) height = self.CNTZ_height;
250 250 height = floor(height);
251   - _imageContainerView.tz_height = height;
252   - _imageContainerView.tz_centerY = self.tz_height / 2;
  251 + _imageContainerView.CNTZ_height = height;
  252 + _imageContainerView.CNTZ_centerY = self.CNTZ_height / 2;
253 253 }
254   - if (_imageContainerView.tz_height > self.tz_height && _imageContainerView.tz_height - self.tz_height <= 1) {
255   - _imageContainerView.tz_height = self.tz_height;
  254 + if (_imageContainerView.CNTZ_height > self.CNTZ_height && _imageContainerView.CNTZ_height - self.CNTZ_height <= 1) {
  255 + _imageContainerView.CNTZ_height = self.CNTZ_height;
256 256 }
257   - CGFloat contentSizeH = MAX(_imageContainerView.tz_height, self.tz_height);
258   - _scrollView.contentSize = CGSizeMake(self.scrollView.tz_width, contentSizeH);
  257 + CGFloat contentSizeH = MAX(_imageContainerView.CNTZ_height, self.CNTZ_height);
  258 + _scrollView.contentSize = CGSizeMake(self.scrollView.CNTZ_width, contentSizeH);
259 259 [_scrollView scrollRectToVisible:self.bounds animated:NO];
260   - _scrollView.alwaysBounceVertical = _imageContainerView.tz_height <= self.tz_height ? NO : YES;
  260 + _scrollView.alwaysBounceVertical = _imageContainerView.CNTZ_height <= self.CNTZ_height ? NO : YES;
261 261 _imageView.frame = _imageContainerView.bounds;
262 262  
263 263 [self refreshScrollViewContentSize];
... ... @@ -281,10 +281,10 @@
281 281 if (_allowCrop) {
282 282 // 1.7.2 如果允许裁剪,需要让图片的任意部分都能在裁剪框内,于是对_scrollView做了如下处理:
283 283 // 1.让contentSize增大(裁剪框右下角的图片部分)
284   - CGFloat contentWidthAdd = self.scrollView.tz_width - CGRectGetMaxX(_cropRect);
285   - CGFloat contentHeightAdd = (MIN(_imageContainerView.tz_height, self.tz_height) - self.cropRect.size.height) / 2;
  284 + CGFloat contentWidthAdd = self.scrollView.CNTZ_width - CGRectGetMaxX(_cropRect);
  285 + CGFloat contentHeightAdd = (MIN(_imageContainerView.CNTZ_height, self.CNTZ_height) - self.cropRect.size.height) / 2;
286 286 CGFloat newSizeW = self.scrollView.contentSize.width + contentWidthAdd;
287   - CGFloat newSizeH = MAX(self.scrollView.contentSize.height, self.tz_height) + contentHeightAdd;
  287 + CGFloat newSizeH = MAX(self.scrollView.contentSize.height, self.CNTZ_height) + contentHeightAdd;
288 288 _scrollView.contentSize = CGSizeMake(newSizeW, newSizeH);
289 289 _scrollView.alwaysBounceVertical = YES;
290 290 // 2.让scrollView新增滑动区域(裁剪框左上角的图片部分)
... ... @@ -298,10 +298,10 @@
298 298  
299 299 - (void)layoutSubviews {
300 300 [super layoutSubviews];
301   - _scrollView.frame = CGRectMake(10, 0, self.tz_width - 20, self.tz_height);
  301 + _scrollView.frame = CGRectMake(10, 0, self.CNTZ_width - 20, self.CNTZ_height);
302 302 static CGFloat progressWH = 40;
303   - CGFloat progressX = (self.tz_width - progressWH) / 2;
304   - CGFloat progressY = (self.tz_height - progressWH) / 2;
  303 + CGFloat progressX = (self.CNTZ_width - progressWH) / 2;
  304 + CGFloat progressY = (self.CNTZ_height - progressWH) / 2;
305 305 _progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH);
306 306  
307 307 [self recoverSubviews];
... ... @@ -349,15 +349,15 @@
349 349 #pragma mark - Private
350 350  
351 351 - (void)refreshImageContainerViewCenter {
352   - CGFloat offsetX = (_scrollView.tz_width > _scrollView.contentSize.width) ? ((_scrollView.tz_width - _scrollView.contentSize.width) * 0.5) : 0.0;
353   - CGFloat offsetY = (_scrollView.tz_height > _scrollView.contentSize.height) ? ((_scrollView.tz_height - _scrollView.contentSize.height) * 0.5) : 0.0;
  352 + CGFloat offsetX = (_scrollView.CNTZ_width > _scrollView.contentSize.width) ? ((_scrollView.CNTZ_width - _scrollView.contentSize.width) * 0.5) : 0.0;
  353 + CGFloat offsetY = (_scrollView.CNTZ_height > _scrollView.contentSize.height) ? ((_scrollView.CNTZ_height - _scrollView.contentSize.height) * 0.5) : 0.0;
354 354 self.imageContainerView.center = CGPointMake(_scrollView.contentSize.width * 0.5 + offsetX, _scrollView.contentSize.height * 0.5 + offsetY);
355 355 }
356 356  
357 357 @end
358 358  
359 359  
360   -@implementation TZVideoPreviewCell
  360 +@implementation CNTZVideoPreviewCell
361 361  
362 362 - (void)dealloc
363 363 {
... ... @@ -400,14 +400,14 @@
400 400 [_progressView removeFromSuperview];
401 401 }
402 402  
403   - _progressView = [[TZProgressView alloc]init];
  403 + _progressView = [[CNTZProgressView alloc]init];
404 404 _progressView.hidden = YES;
405 405 [self addSubview:_progressView];
406 406  
407 407 }
408 408  
409 409  
410   -- (void)setModel:(TZAssetModel *)model {
  410 +- (void)setModel:(CNTZAssetModel *)model {
411 411 [super setModel:model];
412 412 [self configMoviePlayer];
413 413 }
... ... @@ -427,7 +427,7 @@
427 427 }
428 428  
429 429 __weak typeof(self) weakSelf = self;
430   - [[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
  430 + [[CNTZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
431 431 NSLog(@"输出图片info = %@",info);
432 432 /** 获取图片 */
433 433 weakSelf.cover = photo;
... ... @@ -441,7 +441,7 @@
441 441  
442 442 if (self.model.isVideoICloudDownLoad || !self.model.isICloudType) {//已下载 或 不是iCloud
443 443  
444   - [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
  444 + [[CNTZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
445 445  
446 446 dispatch_async(dispatch_get_main_queue(), ^{
447 447  
... ... @@ -540,7 +540,7 @@
540 540  
541 541 [self configProgressView];//添加HUD
542 542  
543   - [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
  543 + [[CNTZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
544 544  
545 545 NSLog(@"输出视频info = %@",info);
546 546  
... ... @@ -654,8 +654,8 @@
654 654 - (void)layoutSubviews {
655 655 [super layoutSubviews];
656 656 _playerLayer.frame = self.bounds;
657   - _playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44);
658   - _progressView.frame = CGRectMake((self.tz_width - 50)/2, (self.tz_height - 50)/2 , 50, 50);
  657 + _playButton.frame = CGRectMake(0, 64, self.CNTZ_width, self.CNTZ_height - 64 - 44);
  658 + _progressView.frame = CGRectMake((self.CNTZ_width - 50)/2, (self.CNTZ_height - 50)/2 , 50, 50);
659 659 }
660 660  
661 661 - (void)photoPreviewCollectionViewDidScroll {
... ... @@ -723,14 +723,14 @@
723 723 @end
724 724  
725 725  
726   -@implementation TZGifPreviewCell
  726 +@implementation CNTZGifPreviewCell
727 727  
728 728 - (void)configSubviews {
729 729 [self configPreviewView];
730 730 }
731 731  
732 732 - (void)configPreviewView {
733   - _previewView = [[TZPhotoPreviewView alloc] initWithFrame:CGRectZero];
  733 + _previewView = [[CNTZPhotoPreviewView alloc] initWithFrame:CGRectZero];
734 734 __weak typeof(self) weakSelf = self;
735 735 [_previewView setSingleTapGestureBlock:^{
736 736 __strong typeof(weakSelf) strongSelf = weakSelf;
... ... @@ -739,7 +739,7 @@
739 739 [self addSubview:_previewView];
740 740 }
741 741  
742   -- (void)setModel:(TZAssetModel *)model {
  742 +- (void)setModel:(CNTZAssetModel *)model {
743 743 [super setModel:model];
744 744 _previewView.model = self.model;
745 745 }
... ...
CNLiveImagePickerController/Classes/TZPhotoPreviewController.h renamed to CNLiveImagePickerController/Classes/CNTZPhotoPreviewController.h
1 1 //
2   -// TZPhotoPreviewController.h
3   -// TZImagePickerController
  2 +// CNTZPhotoPreviewController.h
  3 +// CNTZImagePickerController
4 4 //
5 5 // Created by 谭真 on 15/12/24.
6 6 // Copyright © 2015年 谭真. All rights reserved.
... ... @@ -13,7 +13,7 @@ typedef enum : NSUInteger {
13 13 PhotoPreviewEnterTypeSelected,
14 14 } PhotoPreviewEnterType;
15 15  
16   -@interface TZPhotoPreviewController : UIViewController
  16 +@interface CNTZPhotoPreviewController : UIViewController
17 17  
18 18 @property (nonatomic, assign) PhotoPreviewEnterType enterType;
19 19  
... ...