Commit 49bd669b authored by 肖兰月's avatar 肖兰月

解决提交dark mode合并冲突

parents f7c5f13f 860fba1a
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
## 重要提示1:提issue前,请先对照Demo、常见问题自查!Demo正常说明你可以升级下新版试试。 ## 重要提示1:提issue前,请先对照Demo、常见问题自查!Demo正常说明你可以升级下新版试试。
## 重要提示2:3.0.7版本适配了iPhoneXR、XS、XS Max,建议大家尽快更新 ## 重要提示2:3.4.2版本适配了iOS14,修复2个严重问题,强烈建议尽快更新
关于升级iOS10和Xcdoe8的提示: 关于升级iOS10和Xcdoe8的提示:
在Xcode8环境下将项目运行在iOS10的设备/模拟器中,访问相册和相机需要额外配置info.plist文件。分别是Privacy - Photo Library Usage Description和Privacy - Camera Usage Description字段,详见Demo中info.plist中的设置。 在Xcode8环境下将项目运行在iOS10的设备/模拟器中,访问相册和相机需要额外配置info.plist文件。分别是Privacy - Photo Library Usage Description和Privacy - Camera Usage Description字段,详见Demo中info.plist中的设置。
...@@ -123,6 +123,7 @@ A:不要去拿PHImageFileURLKey,没用的,只有通过Photos框架才能 ...@@ -123,6 +123,7 @@ A:不要去拿PHImageFileURLKey,没用的,只有通过Photos框架才能
## 六. Release Notes 最近更新 ## 六. Release Notes 最近更新
**3.4.2 适配iOS14,若干问题修复**
3.3.2 适配iOS13,若干问题修复 3.3.2 适配iOS13,若干问题修复
3.2.1 新增裁剪用scaleAspectFillCrop属性,设置为YES后,照片尺寸小于裁剪框时会自动放大撑满 3.2.1 新增裁剪用scaleAspectFillCrop属性,设置为YES后,照片尺寸小于裁剪框时会自动放大撑满
3.2.0 加入用NSOperationQueue控制获取原图并发数降低内存的示例 3.2.0 加入用NSOperationQueue控制获取原图并发数降低内存的示例
...@@ -130,7 +131,7 @@ A:不要去拿PHImageFileURLKey,没用的,只有通过Photos框架才能 ...@@ -130,7 +131,7 @@ A:不要去拿PHImageFileURLKey,没用的,只有通过Photos框架才能
3.1.5 相册内无照片时给出提示,修复快速滑动时内存一直增加的问题 3.1.5 相册内无照片时给出提示,修复快速滑动时内存一直增加的问题
3.1.3 适配阿拉伯等语言下从右往左布局的特性 3.1.3 适配阿拉伯等语言下从右往左布局的特性
3.0.8 新增gifImagePlayBlock允许使用FLAnimatedImage等替换内部的GIF播放方案 3.0.8 新增gifImagePlayBlock允许使用FLAnimatedImage等替换内部的GIF播放方案
**3.0.7 适配iPhoneXR、XS、XS Max,建议大家尽快更新** 3.0.7 适配iPhoneXR、XS、XS Max
3.0.6 优化保存照片、视频的方法 3.0.6 优化保存照片、视频的方法
3.0.1 新增对[TZImagePreviewController](https://github.com/banchichen/TZImagePreviewController)库的支持,允许预览UIImage、NSURL、PHAsset对象 3.0.1 新增对[TZImagePreviewController](https://github.com/banchichen/TZImagePreviewController)库的支持,允许预览UIImage、NSURL、PHAsset对象
**3.0.0 去除iOS6和7的适配代码,更轻量,最低支持iOS8** **3.0.0 去除iOS6和7的适配代码,更轻量,最低支持iOS8**
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "TZImagePickerController" s.name = "TZImagePickerController"
s.version = "3.3.2" s.version = "3.4.2"
s.summary = "A clone of UIImagePickerController, support picking multiple photos、original photo and video" s.summary = "A clone of UIImagePickerController, support picking multiple photos、original photo and video"
s.homepage = "https://github.com/banchichen/TZImagePickerController" s.homepage = "https://github.com/banchichen/TZImagePickerController"
s.license = "MIT" s.license = "MIT"
s.author = { "banchichen" => "tanzhenios@foxmail.com" } s.author = { "banchichen" => "tanzhenios@foxmail.com" }
s.platform = :ios s.platform = :ios
s.ios.deployment_target = "8.0" s.ios.deployment_target = "8.0"
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "3.3.2" } s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "3.4.2" }
s.requires_arc = true s.requires_arc = true
s.resources = "TZImagePickerController/TZImagePickerController/*.{png,bundle}" s.resources = "TZImagePickerController/TZImagePickerController/*.{png,bundle}"
s.source_files = "TZImagePickerController/TZImagePickerController/*.{h,m}" s.source_files = "TZImagePickerController/TZImagePickerController/*.{h,m}"
s.frameworks = "Photos", "MobileCoreServices" s.frameworks = "Photos"
end end
...@@ -924,7 +924,7 @@ ...@@ -924,7 +924,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.3.2; MARKETING_VERSION = 3.4.2;
OTHER_LDFLAGS = "-all_load"; OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerControllerFramework; PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerControllerFramework;
PRODUCT_NAME = TZImagePickerController; PRODUCT_NAME = TZImagePickerController;
...@@ -965,7 +965,7 @@ ...@@ -965,7 +965,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MARKETING_VERSION = 3.3.2; MARKETING_VERSION = 3.4.2;
OTHER_LDFLAGS = "-all_load"; OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerControllerFramework; PRODUCT_BUNDLE_IDENTIFIER = tanzhen.TZImagePickerControllerFramework;
PRODUCT_NAME = TZImagePickerController; PRODUCT_NAME = TZImagePickerController;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
// Set the cell's thumbnail image if it's still showing the same asset. // Set the cell's thumbnail image if it's still showing the same asset.
if ([self.representedAssetIdentifier isEqualToString:model.asset.localIdentifier]) { if ([self.representedAssetIdentifier isEqualToString:model.asset.localIdentifier]) {
self.imageView.image = photo; self.imageView.image = photo;
[self setNeedsLayout];
} else { } else {
// NSLog(@"this cell is showing other asset"); // NSLog(@"this cell is showing other asset");
[[PHImageManager defaultManager] cancelImageRequest:self.imageRequestID]; [[PHImageManager defaultManager] cancelImageRequest:self.imageRequestID];
...@@ -168,6 +169,12 @@ ...@@ -168,6 +169,12 @@
} }
_bigImageRequestID = [[TZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) { _bigImageRequestID = [[TZImageManager manager] requestImageDataForAsset:_model.asset completion:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
BOOL iCloudSyncFailed = !imageData && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.model.iCloudFailed = iCloudSyncFailed;
if (iCloudSyncFailed && self.didSelectPhotoBlock) {
self.didSelectPhotoBlock(YES);
self.selectImageView.image = self.photoDefImage;
}
[self hideProgressView]; [self hideProgressView];
} progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { } progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
if (self.model.isSelected) { if (self.model.isSelected) {
...@@ -185,6 +192,18 @@ ...@@ -185,6 +192,18 @@
[self cancelBigImageRequest]; [self cancelBigImageRequest];
} }
}]; }];
if (_model.type == TZAssetCellTypeVideo) {
[[TZImageManager manager] getVideoWithAsset:_model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
BOOL iCloudSyncFailed = !playerItem && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.model.iCloudFailed = iCloudSyncFailed;
if (iCloudSyncFailed && self.didSelectPhotoBlock) {
dispatch_async(dispatch_get_main_queue(), ^{
self.didSelectPhotoBlock(YES);
self.selectImageView.image = self.photoDefImage;
});
}
}];
}
} }
- (void)cancelBigImageRequest { - (void)cancelBigImageRequest {
...@@ -266,6 +285,7 @@ ...@@ -266,6 +285,7 @@
if (_bottomView == nil) { if (_bottomView == nil) {
UIView *bottomView = [[UIView alloc] init]; UIView *bottomView = [[UIView alloc] init];
static NSInteger rgb = 0; static NSInteger rgb = 0;
bottomView.userInteractionEnabled = NO;
bottomView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.8]; bottomView.backgroundColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:0.8];
[self.contentView addSubview:bottomView]; [self.contentView addSubview:bottomView];
_bottomView = bottomView; _bottomView = bottomView;
...@@ -341,8 +361,8 @@ ...@@ -341,8 +361,8 @@
_selectImageView.contentMode = UIViewContentModeScaleAspectFit; _selectImageView.contentMode = UIViewContentModeScaleAspectFit;
} }
_indexLabel.frame = _selectImageView.frame; _indexLabel.frame = _selectImageView.frame;
_imageView.frame = CGRectMake(0, 0, self.tz_width, self.tz_height); _imageView.frame = self.bounds;
static CGFloat progressWH = 20; static CGFloat progressWH = 20;
CGFloat progressXY = (self.tz_width - progressWH) / 2; CGFloat progressXY = (self.tz_width - progressWH) / 2;
_progressView.frame = CGRectMake(progressXY, progressXY, progressWH, progressWH); _progressView.frame = CGRectMake(progressXY, progressXY, progressWH, progressWH);
...@@ -398,6 +418,7 @@ ...@@ -398,6 +418,7 @@
self.titleLabel.attributedText = nameString; self.titleLabel.attributedText = nameString;
[[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) { [[TZImageManager manager] getPostImageWithAlbumModel:model completion:^(UIImage *postImage) {
self.posterImageView.image = postImage; self.posterImageView.image = postImage;
[self setNeedsLayout];
}]; }];
if (model.selectedCount) { if (model.selectedCount) {
self.selectedCountButton.hidden = NO; self.selectedCountButton.hidden = NO;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <Photos/Photos.h>
typedef enum : NSUInteger { typedef enum : NSUInteger {
TZAssetModelMediaTypePhoto = 0, TZAssetModelMediaTypePhoto = 0,
...@@ -24,6 +25,7 @@ typedef enum : NSUInteger { ...@@ -24,6 +25,7 @@ typedef enum : NSUInteger {
@property (nonatomic, assign) BOOL isSelected; ///< The select status of a photo, default is No @property (nonatomic, assign) BOOL isSelected; ///< The select status of a photo, default is No
@property (nonatomic, assign) TZAssetModelMediaType type; @property (nonatomic, assign) TZAssetModelMediaType type;
@property (nonatomic, copy) NSString *timeLength; @property (nonatomic, copy) NSString *timeLength;
@property (nonatomic, assign) BOOL iCloudFailed;
/// Init a photo dataModel With a PHAsset /// Init a photo dataModel With a PHAsset
/// 用一个PHAsset实例,初始化一个照片模型 /// 用一个PHAsset实例,初始化一个照片模型
...@@ -39,6 +41,8 @@ typedef enum : NSUInteger { ...@@ -39,6 +41,8 @@ typedef enum : NSUInteger {
@property (nonatomic, strong) NSString *name; ///< The album name @property (nonatomic, strong) NSString *name; ///< The album name
@property (nonatomic, assign) NSInteger count; ///< Count of photos the album contain @property (nonatomic, assign) NSInteger count; ///< Count of photos the album contain
@property (nonatomic, strong) PHFetchResult *result; @property (nonatomic, strong) PHFetchResult *result;
@property (nonatomic, strong) PHAssetCollection *collection;
@property (nonatomic, strong) PHFetchOptions *options;
@property (nonatomic, strong) NSArray *models; @property (nonatomic, strong) NSArray *models;
@property (nonatomic, strong) NSArray *selectedModels; @property (nonatomic, strong) NSArray *selectedModels;
...@@ -47,5 +51,6 @@ typedef enum : NSUInteger { ...@@ -47,5 +51,6 @@ typedef enum : NSUInteger {
@property (nonatomic, assign) BOOL isCameraRoll; @property (nonatomic, assign) BOOL isCameraRoll;
- (void)setResult:(PHFetchResult *)result needFetchAssets:(BOOL)needFetchAssets; - (void)setResult:(PHFetchResult *)result needFetchAssets:(BOOL)needFetchAssets;
- (void)refreshFetchResult;
@end @end
...@@ -43,6 +43,12 @@ ...@@ -43,6 +43,12 @@
} }
} }
- (void)refreshFetchResult {
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:self.collection options:self.options];
self.count = fetchResult.count;
[self setResult:fetchResult];
}
- (void)setSelectedModels:(NSArray *)selectedModels { - (void)setSelectedModels:(NSArray *)selectedModels {
_selectedModels = selectedModels; _selectedModels = selectedModels;
if (_models) { if (_models) {
......
...@@ -117,7 +117,7 @@ static dispatch_once_t onceToken; ...@@ -117,7 +117,7 @@ static dispatch_once_t onceToken;
if (collection.estimatedAssetCount <= 0) continue; if (collection.estimatedAssetCount <= 0) continue;
if ([self isCameraRollAlbum:collection]) { if ([self isCameraRollAlbum:collection]) {
PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option]; PHFetchResult *fetchResult = [PHAsset fetchAssetsInAssetCollection:collection options:option];
model = [self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:YES needFetchAssets:needFetchAssets]; model = [self modelWithResult:fetchResult collection:collection isCameraRoll:YES needFetchAssets:needFetchAssets options:option];
if (completion) completion(model); if (completion) completion(model);
break; break;
} }
...@@ -159,9 +159,9 @@ static dispatch_once_t onceToken; ...@@ -159,9 +159,9 @@ static dispatch_once_t onceToken;
if (collection.assetCollectionSubtype == PHAssetCollectionSubtypeSmartAlbumAllHidden) continue; if (collection.assetCollectionSubtype == PHAssetCollectionSubtypeSmartAlbumAllHidden) continue;
if (collection.assetCollectionSubtype == 1000000201) continue; //『最近删除』相册 if (collection.assetCollectionSubtype == 1000000201) continue; //『最近删除』相册
if ([self isCameraRollAlbum:collection]) { if ([self isCameraRollAlbum:collection]) {
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:YES needFetchAssets:needFetchAssets] atIndex:0]; [albumArr insertObject:[self modelWithResult:fetchResult collection:collection isCameraRoll:YES needFetchAssets:needFetchAssets options:option] atIndex:0];
} else { } else {
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:NO needFetchAssets:needFetchAssets]]; [albumArr addObject:[self modelWithResult:fetchResult collection:collection isCameraRoll:NO needFetchAssets:needFetchAssets options:option]];
} }
} }
} }
...@@ -485,8 +485,7 @@ static dispatch_once_t onceToken; ...@@ -485,8 +485,7 @@ static dispatch_once_t onceToken;
} completionHandler:^(BOOL success, NSError *error) { } completionHandler:^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (success && completion) { if (success && completion) {
PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil] firstObject]; [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];
completion(asset, nil);
} else if (error) { } else if (error) {
NSLog(@"保存照片出错:%@",error.localizedDescription); NSLog(@"保存照片出错:%@",error.localizedDescription);
if (completion) { if (completion) {
...@@ -522,8 +521,7 @@ static dispatch_once_t onceToken; ...@@ -522,8 +521,7 @@ static dispatch_once_t onceToken;
[[NSFileManager defaultManager] removeItemAtPath:path error:nil]; [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (success && completion) { if (success && completion) {
PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil] firstObject]; [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];
completion(asset, nil);
} else if (error) { } else if (error) {
NSLog(@"保存照片出错:%@",error.localizedDescription); NSLog(@"保存照片出错:%@",error.localizedDescription);
if (completion) { if (completion) {
...@@ -534,6 +532,19 @@ static dispatch_once_t onceToken; ...@@ -534,6 +532,19 @@ static dispatch_once_t onceToken;
}]; }];
} }
- (void)fetchAssetByIocalIdentifier:(NSString *)localIdentifier retryCount:(NSInteger)retryCount completion:(void (^)(PHAsset *asset, NSError *error))completion {
PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil] firstObject];
if (asset || retryCount <= 0) {
if (completion) {
completion(asset, nil);
}
return;
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self fetchAssetByIocalIdentifier:localIdentifier retryCount:retryCount - 1 completion:completion];
});
}
#pragma mark - Save video #pragma mark - Save video
- (void)saveVideoWithUrl:(NSURL *)url completion:(void (^)(PHAsset *asset, NSError *error))completion { - (void)saveVideoWithUrl:(NSURL *)url completion:(void (^)(PHAsset *asset, NSError *error))completion {
...@@ -552,8 +563,7 @@ static dispatch_once_t onceToken; ...@@ -552,8 +563,7 @@ static dispatch_once_t onceToken;
} completionHandler:^(BOOL success, NSError *error) { } completionHandler:^(BOOL success, NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (success && completion) { if (success && completion) {
PHAsset *asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[localIdentifier] options:nil] firstObject]; [self fetchAssetByIocalIdentifier:localIdentifier retryCount:10 completion:completion];
completion(asset, nil);
} else if (error) { } else if (error) {
NSLog(@"保存视频出错:%@",error.localizedDescription); NSLog(@"保存视频出错:%@",error.localizedDescription);
if (completion) { if (completion) {
...@@ -727,10 +737,12 @@ static dispatch_once_t onceToken; ...@@ -727,10 +737,12 @@ static dispatch_once_t onceToken;
#pragma mark - Private Method #pragma mark - Private Method
- (TZAlbumModel *)modelWithResult:(PHFetchResult *)result name:(NSString *)name isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets { - (TZAlbumModel *)modelWithResult:(PHFetchResult *)result collection:(PHAssetCollection *)collection isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets options:(PHFetchOptions *)options {
TZAlbumModel *model = [[TZAlbumModel alloc] init]; TZAlbumModel *model = [[TZAlbumModel alloc] init];
[model setResult:result needFetchAssets:needFetchAssets]; [model setResult:result needFetchAssets:needFetchAssets];
model.name = name; model.name = collection.localizedTitle;
model.collection = collection;
model.options = options;
model.isCameraRoll = isCameraRoll; model.isCameraRoll = isCameraRoll;
model.count = result.count; model.count = result.count;
return model; return model;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "معالجة..."; "Processing..." = "معالجة...";
"No Photos or Videos" = "لا توجد صور أو مقاطع فيديو"; "No Photos or Videos" = "لا توجد صور أو مقاطع فيديو";
"Synchronizing photos from iCloud" = "مزامنة الصور من iCloud"; "Synchronizing photos from iCloud" = "مزامنة الصور من iCloud";
"iCloud sync failed" = "iCloud فشلت المزامنة";
"Can not use camera" = "لا يمكن استخدام الكاميرا"; "Can not use camera" = "لا يمكن استخدام الكاميرا";
"Can not choose both video and photo" = "لا يمكن اختيار كل من الفيديو والصور"; "Can not choose both video and photo" = "لا يمكن اختيار كل من الفيديو والصور";
"Can not choose both photo and GIF" = "لا يمكن اختيار كل من الصور و GIF"; "Can not choose both photo and GIF" = "لا يمكن اختيار كل من الصور و GIF";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Обработка ..."; "Processing..." = "Обработка ...";
"No Photos or Videos" = "Няма снимки или видеоклипове"; "No Photos or Videos" = "Няма снимки или видеоклипове";
"Synchronizing photos from iCloud" = "Синхронизиране на снимки от iCloud"; "Synchronizing photos from iCloud" = "Синхронизиране на снимки от iCloud";
"iCloud sync failed" = "iCloud синхронизирането не бе успешно";
"Can not use camera" = "Не може да се използва камера"; "Can not use camera" = "Не може да се използва камера";
"Can not choose both video and photo" = "Не можете да изберете видео и снимка"; "Can not choose both video and photo" = "Не можете да изберете видео и снимка";
"Can not choose both photo and GIF" = "Не може да се избере снимка и GIF"; "Can not choose both photo and GIF" = "Не може да се избере снимка и GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Zpracovává se..."; "Processing..." = "Zpracovává se...";
"No Photos or Videos" = "Žádné fotky nebo videa"; "No Photos or Videos" = "Žádné fotky nebo videa";
"Synchronizing photos from iCloud" = "Synchronizace fotografií z iCloud"; "Synchronizing photos from iCloud" = "Synchronizace fotografií z iCloud";
"iCloud sync failed" = "iCloud synchronizace selhala";
"Can not use camera" = "Nelze použít fotoaparát"; "Can not use camera" = "Nelze použít fotoaparát";
"Can not choose both video and photo" = "Nelze vybrat video ani fotografii"; "Can not choose both video and photo" = "Nelze vybrat video ani fotografii";
"Can not choose both photo and GIF" = "Nelze vybrat fotografie a GIF"; "Can not choose both photo and GIF" = "Nelze vybrat fotografie a GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Wird bearbeitet..."; "Processing..." = "Wird bearbeitet...";
"No Photos or Videos" = "Keine Fotos oder Videos"; "No Photos or Videos" = "Keine Fotos oder Videos";
"Synchronizing photos from iCloud" = "Fotos aus iCloud synchronisieren"; "Synchronizing photos from iCloud" = "Fotos aus iCloud synchronisieren";
"iCloud sync failed" = "iCloud Synchronisierung fehlgeschlagen";
"Can not use camera" = "Kann die Kamera nicht benutzen"; "Can not use camera" = "Kann die Kamera nicht benutzen";
"Can not choose both video and photo" = "Video und Foto können nicht ausgewählt werden"; "Can not choose both video and photo" = "Video und Foto können nicht ausgewählt werden";
"Can not choose both photo and GIF" = "Foto und GIF können nicht ausgewählt werden"; "Can not choose both photo and GIF" = "Foto und GIF können nicht ausgewählt werden";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Επεξεργασία..."; "Processing..." = "Επεξεργασία...";
"No Photos or Videos" = "Δεν υπάρχουν φωτογραφίες ή βίντεο"; "No Photos or Videos" = "Δεν υπάρχουν φωτογραφίες ή βίντεο";
"Synchronizing photos from iCloud" = "Συγχρονισμός φωτογραφιών από το iCloud"; "Synchronizing photos from iCloud" = "Συγχρονισμός φωτογραφιών από το iCloud";
"iCloud sync failed" = "iCloud Ο συγχρονισμός απέτυχε";
"Can not use camera" = "Δεν είναι δυνατή η χρήση της κάμερας"; "Can not use camera" = "Δεν είναι δυνατή η χρήση της κάμερας";
"Can not choose both video and photo" = "Δεν είναι δυνατή η επιλογή του βίντεο και της φωτογραφίας"; "Can not choose both video and photo" = "Δεν είναι δυνατή η επιλογή του βίντεο και της φωτογραφίας";
"Can not choose both photo and GIF" = "Δεν είναι δυνατή η επιλογή φωτογραφίας και GIF"; "Can not choose both photo and GIF" = "Δεν είναι δυνατή η επιλογή φωτογραφίας και GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Tratamiento..."; "Processing..." = "Tratamiento...";
"No Photos or Videos" = "No hay fotos o videos"; "No Photos or Videos" = "No hay fotos o videos";
"Synchronizing photos from iCloud" = "Sincronizando fotos desde iCloud"; "Synchronizing photos from iCloud" = "Sincronizando fotos desde iCloud";
"iCloud sync failed" = "la sincronización falló";
"Can not use camera" = "No puedo usar la camara"; "Can not use camera" = "No puedo usar la camara";
"Can not choose both video and photo" = "No se puede elegir tanto el video como la foto."; "Can not choose both video and photo" = "No se puede elegir tanto el video como la foto.";
"Can not choose both photo and GIF" = "No se puede elegir tanto foto como GIF"; "Can not choose both photo and GIF" = "No se puede elegir tanto foto como GIF";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "En traitement..."; "Processing..." = "En traitement...";
"No Photos or Videos" = "Aucune photo ou vidéo"; "No Photos or Videos" = "Aucune photo ou vidéo";
"Synchronizing photos from iCloud" = "Synchroniser des photos depuis iCloud"; "Synchronizing photos from iCloud" = "Synchroniser des photos depuis iCloud";
"iCloud sync failed" = "iCloud échec de la synchronisation";
"Can not use camera" = "Impossible d'utiliser la caméra"; "Can not use camera" = "Impossible d'utiliser la caméra";
"Can not choose both video and photo" = "Impossible de choisir à la fois la vidéo et la photo"; "Can not choose both video and photo" = "Impossible de choisir à la fois la vidéo et la photo";
"Can not choose both photo and GIF" = "Impossible de choisir à la fois photo et GIF"; "Can not choose both photo and GIF" = "Impossible de choisir à la fois photo et GIF";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "מעבד..."; "Processing..." = "מעבד...";
"No Photos or Videos" = "אין תמונות או סרטונים"; "No Photos or Videos" = "אין תמונות או סרטונים";
"Synchronizing photos from iCloud" = "סנכרון תמונות מ - iCloud"; "Synchronizing photos from iCloud" = "סנכרון תמונות מ - iCloud";
"iCloud sync failed" = "iCloud הסנכרון נכשל";
"Can not use camera" = "לא ניתן להשתמש במצלמה"; "Can not use camera" = "לא ניתן להשתמש במצלמה";
"Can not choose both video and photo" = "לא ניתן לבחור הן בסרטון והן בתמונה"; "Can not choose both video and photo" = "לא ניתן לבחור הן בסרטון והן בתמונה";
"Can not choose both photo and GIF" = "לא ניתן לבחור גם תמונה וגם קובץ GIF"; "Can not choose both photo and GIF" = "לא ניתן לבחור גם תמונה וגם קובץ GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "In lavorazione..."; "Processing..." = "In lavorazione...";
"No Photos or Videos" = "Nessuna foto o video"; "No Photos or Videos" = "Nessuna foto o video";
"Synchronizing photos from iCloud" = "Sincronizzazione delle foto da iCloud"; "Synchronizing photos from iCloud" = "Sincronizzazione delle foto da iCloud";
"iCloud sync failed" = "iCloud sincronizzazione non riuscita";
"Can not use camera" = "Non è possibile utilizzare la fotocamera"; "Can not use camera" = "Non è possibile utilizzare la fotocamera";
"Can not choose both video and photo" = "Non è possibile scegliere sia video che foto"; "Can not choose both video and photo" = "Non è possibile scegliere sia video che foto";
"Can not choose both photo and GIF" = "Non è possibile scegliere sia foto che GIF"; "Can not choose both photo and GIF" = "Non è possibile scegliere sia foto che GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "処理..."; "Processing..." = "処理...";
"No Photos or Videos" = "写真やビデオはありません"; "No Photos or Videos" = "写真やビデオはありません";
"Synchronizing photos from iCloud" = "iCloudから写真を同期する"; "Synchronizing photos from iCloud" = "iCloudから写真を同期する";
"iCloud sync failed" = "iCloud同期に失敗しました";
"Can not use camera" = "カメラが使えない"; "Can not use camera" = "カメラが使えない";
"Can not choose both video and photo" = "ビデオと写真の両方を選択することはできません"; "Can not choose both video and photo" = "ビデオと写真の両方を選択することはできません";
"Can not choose both photo and GIF" = "写真とGIFの両方を選択することはできません"; "Can not choose both photo and GIF" = "写真とGIFの両方を選択することはできません";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "처리..."; "Processing..." = "처리...";
"No Photos or Videos" = "아무 사진이 나 동영상"; "No Photos or Videos" = "아무 사진이 나 동영상";
"Synchronizing photos from iCloud" = "ICloud에서 사진을 동기화"; "Synchronizing photos from iCloud" = "ICloud에서 사진을 동기화";
"iCloud sync failed" = "iCloud동기화 실패";
"Can not use camera" = "카메라를 사용할 수 없습니다."; "Can not use camera" = "카메라를 사용할 수 없습니다.";
"Can not choose both video and photo" = "비디오와 사진 둘 다를 선택할 수 없습니다."; "Can not choose both video and photo" = "비디오와 사진 둘 다를 선택할 수 없습니다.";
"Can not choose both photo and GIF" = "사진 및 GIF를 선택할 수 없습니다."; "Can not choose both photo and GIF" = "사진 및 GIF를 선택할 수 없습니다.";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "처리 중 ..."; "Processing..." = "처리 중 ...";
"No Photos or Videos" = "사진이나 동영상 없음"; "No Photos or Videos" = "사진이나 동영상 없음";
"Synchronizing photos from iCloud" = "iCloud에서 사진 동기화"; "Synchronizing photos from iCloud" = "iCloud에서 사진 동기화";
"iCloud sync failed" = "iCloud동기화 실패";
"Can not use camera" = "카메라를 사용할 수 없습니다."; "Can not use camera" = "카메라를 사용할 수 없습니다.";
"Can not choose both video and photo" = "동영상과 사진을 모두 선택할 수 없습니다."; "Can not choose both video and photo" = "동영상과 사진을 모두 선택할 수 없습니다.";
"Can not choose both photo and GIF" = "사진과 GIF를 모두 선택할 수 없습니다."; "Can not choose both photo and GIF" = "사진과 GIF를 모두 선택할 수 없습니다.";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Verwerken..."; "Processing..." = "Verwerken...";
"No Photos or Videos" = "Geen foto's of video's"; "No Photos or Videos" = "Geen foto's of video's";
"Synchronizing photos from iCloud" = "Foto's synchroniseren vanuit iCloud"; "Synchronizing photos from iCloud" = "Foto's synchroniseren vanuit iCloud";
"iCloud sync failed" = "iCloud synchronisatie is mislukt";
"Can not use camera" = "Kan de camera niet gebruiken"; "Can not use camera" = "Kan de camera niet gebruiken";
"Can not choose both video and photo" = "Kan niet zowel video als foto kiezen"; "Can not choose both video and photo" = "Kan niet zowel video als foto kiezen";
"Can not choose both photo and GIF" = "Kan niet zowel foto als GIF kiezen"; "Can not choose both photo and GIF" = "Kan niet zowel foto als GIF kiezen";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Przetwarzanie..."; "Processing..." = "Przetwarzanie...";
"No Photos or Videos" = "Brak zdjęć lub filmów"; "No Photos or Videos" = "Brak zdjęć lub filmów";
"Synchronizing photos from iCloud" = "Synchronizowanie zdjęć z iCloud"; "Synchronizing photos from iCloud" = "Synchronizowanie zdjęć z iCloud";
"iCloud sync failed" = "iCloud synchronizacja nie powiodła się";
"Can not use camera" = "Nie można używać aparatu"; "Can not use camera" = "Nie można używać aparatu";
"Can not choose both video and photo" = "Nie można wybrać zarówno wideo,jak i zdjęcia"; "Can not choose both video and photo" = "Nie można wybrać zarówno wideo,jak i zdjęcia";
"Can not choose both photo and GIF" = "Nie można wybrać zarówno zdjęcia,jak i GIF"; "Can not choose both photo and GIF" = "Nie można wybrać zarówno zdjęcia,jak i GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Em processamento..."; "Processing..." = "Em processamento...";
"No Photos or Videos" = "Sem fotos ou vídeos"; "No Photos or Videos" = "Sem fotos ou vídeos";
"Synchronizing photos from iCloud" = "Sincronizando fotos do iCloud"; "Synchronizing photos from iCloud" = "Sincronizando fotos do iCloud";
"iCloud sync failed" = "iCloud falha na sincronização";
"Can not use camera" = "Não pode usar a câmera"; "Can not use camera" = "Não pode usar a câmera";
"Can not choose both video and photo" = "Não é possível escolher vídeo e foto"; "Can not choose both video and photo" = "Não é possível escolher vídeo e foto";
"Can not choose both photo and GIF" = "Não é possível escolher foto e GIF"; "Can not choose both photo and GIF" = "Não é possível escolher foto e GIF";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Prelucrare..."; "Processing..." = "Prelucrare...";
"No Photos or Videos" = "Nu există fotografii sau videoclipuri"; "No Photos or Videos" = "Nu există fotografii sau videoclipuri";
"Synchronizing photos from iCloud" = "Sincronizarea fotografiilor cu iCloud"; "Synchronizing photos from iCloud" = "Sincronizarea fotografiilor cu iCloud";
"iCloud sync failed" = "iCloud sincronizarea a eșuat";
"Can not use camera" = "Nu pot folosi camera"; "Can not use camera" = "Nu pot folosi camera";
"Can not choose both video and photo" = "Nu puteți alege atât videoclipul,cât și fotografia"; "Can not choose both video and photo" = "Nu puteți alege atât videoclipul,cât și fotografia";
"Can not choose both photo and GIF" = "Nu puteți alege atât fotografia,cât și GIF"; "Can not choose both photo and GIF" = "Nu puteți alege atât fotografia,cât și GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Обработка ..."; "Processing..." = "Обработка ...";
"No Photos or Videos" = "Нет фото или видео"; "No Photos or Videos" = "Нет фото или видео";
"Synchronizing photos from iCloud" = "Синхронизация фотографий из iCloud"; "Synchronizing photos from iCloud" = "Синхронизация фотографий из iCloud";
"iCloud sync failed" = "iCloud сбой синхронизации";
"Can not use camera" = "Не могу использовать камеру"; "Can not use camera" = "Не могу использовать камеру";
"Can not choose both video and photo" = "Не могу выбрать как видео,так и фото"; "Can not choose both video and photo" = "Не могу выбрать как видео,так и фото";
"Can not choose both photo and GIF" = "Не могу выбрать фото и GIF"; "Can not choose both photo and GIF" = "Не могу выбрать фото и GIF";
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Spracovanie ..."; "Processing..." = "Spracovanie ...";
"No Photos or Videos" = "Žiadne fotografie alebo videá"; "No Photos or Videos" = "Žiadne fotografie alebo videá";
"Synchronizing photos from iCloud" = "Synchronizácia fotografií z iCloud"; "Synchronizing photos from iCloud" = "Synchronizácia fotografií z iCloud";
"iCloud sync failed" = "iCloud synchronizácia zlyhala";
"Can not use camera" = "Fotoaparát nie je možné používať"; "Can not use camera" = "Fotoaparát nie je možné používať";
"Can not choose both video and photo" = "Nie je možné vybrať video aj fotografiu"; "Can not choose both video and photo" = "Nie je možné vybrať video aj fotografiu";
"Can not choose both photo and GIF" = "Nie je možné vybrať fotografie a obrázky GIF"; "Can not choose both photo and GIF" = "Nie je možné vybrať fotografie a obrázky GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Bearbetning ..."; "Processing..." = "Bearbetning ...";
"No Photos or Videos" = "Inga foton eller videor"; "No Photos or Videos" = "Inga foton eller videor";
"Synchronizing photos from iCloud" = "Synkronisera foton från iCloud"; "Synchronizing photos from iCloud" = "Synkronisera foton från iCloud";
"iCloud sync failed" = "iCloud synkroniseringen misslyckades";
"Can not use camera" = "Kan inte använda kamera"; "Can not use camera" = "Kan inte använda kamera";
"Can not choose both video and photo" = "Kan inte välja både video och foto"; "Can not choose both video and photo" = "Kan inte välja både video och foto";
"Can not choose both photo and GIF" = "Kan inte välja både foto och GIF"; "Can not choose both photo and GIF" = "Kan inte välja både foto och GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "กำลังประมวลผล ..."; "Processing..." = "กำลังประมวลผล ...";
"No Photos or Videos" = "ไม่มีรูปภาพหรือวิดีโอ"; "No Photos or Videos" = "ไม่มีรูปภาพหรือวิดีโอ";
"Synchronizing photos from iCloud" = "การซิงโครไนซ์ภาพถ่ายจาก iCloud"; "Synchronizing photos from iCloud" = "การซิงโครไนซ์ภาพถ่ายจาก iCloud";
"iCloud sync failed" = "iCloud การซิงค์ล้มเหลว";
"Can not use camera" = "ไม่สามารถใช้กล้องถ่ายรูป"; "Can not use camera" = "ไม่สามารถใช้กล้องถ่ายรูป";
"Can not choose both video and photo" = "ไม่สามารถเลือกได้ทั้งวิดีโอและภาพถ่าย"; "Can not choose both video and photo" = "ไม่สามารถเลือกได้ทั้งวิดีโอและภาพถ่าย";
"Can not choose both photo and GIF" = "ไม่สามารถเลือกได้ทั้งภาพถ่ายและ GIF"; "Can not choose both photo and GIF" = "ไม่สามารถเลือกได้ทั้งภาพถ่ายและ GIF";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "İşleme..."; "Processing..." = "İşleme...";
"No Photos or Videos" = "Fotoğraf veya Video Yok"; "No Photos or Videos" = "Fotoğraf veya Video Yok";
"Synchronizing photos from iCloud" = "Fotoğrafları iCloud'dan senkronize etme"; "Synchronizing photos from iCloud" = "Fotoğrafları iCloud'dan senkronize etme";
"iCloud sync failed" = "iCloud senkronizasyon başarısız oldu";
"Can not use camera" = "Kamera kullanılamaz"; "Can not use camera" = "Kamera kullanılamaz";
"Can not choose both video and photo" = "Hem video hem de fotoğraf seçilemiyor"; "Can not choose both video and photo" = "Hem video hem de fotoğraf seçilemiyor";
"Can not choose both photo and GIF" = "Hem fotoğraf hem de GIF seçilemiyor"; "Can not choose both photo and GIF" = "Hem fotoğraf hem de GIF seçilemiyor";
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"Processing..." = "Обробка ..."; "Processing..." = "Обробка ...";
"No Photos or Videos" = "Немає фотографій або відео"; "No Photos or Videos" = "Немає фотографій або відео";
"Synchronizing photos from iCloud" = "Синхронізація фотографій з iCloud"; "Synchronizing photos from iCloud" = "Синхронізація фотографій з iCloud";
"iCloud sync failed" = "iCloud помилка синхронізації";
"Can not use camera" = "Не можна використовувати камеру"; "Can not use camera" = "Не можна використовувати камеру";
"Can not choose both video and photo" = "Неможливо вибрати як відео,так і фото"; "Can not choose both video and photo" = "Неможливо вибрати як відео,так і фото";
"Can not choose both photo and GIF" = "Неможливо вибрати як фото,так і GIF"; "Can not choose both photo and GIF" = "Неможливо вибрати як фото,так і GIF";
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
"No Photos or Videos" = "Không có ảnh hoặc video"; "No Photos or Videos" = "Không có ảnh hoặc video";
"Can not use camera" = "Máy chụp hình không khả dụng"; "Can not use camera" = "Máy chụp hình không khả dụng";
"Synchronizing photos from iCloud" = "Đang đồng bộ hình ảnh từ ICloud"; "Synchronizing photos from iCloud" = "Đang đồng bộ hình ảnh từ ICloud";
"iCloud sync failed" = "iCloud đồng bộ hóa không thành công";
"Can not choose both video and photo" = "Trong lúc chọn hình ảnh không cùng lúc chọn video"; "Can not choose both video and photo" = "Trong lúc chọn hình ảnh không cùng lúc chọn video";
"Can not choose both photo and GIF" = "Trong lúc chọn hình ảnh không cùng lúc chọn hình GIF"; "Can not choose both photo and GIF" = "Trong lúc chọn hình ảnh không cùng lúc chọn hình GIF";
"Select the video when in multi state, we will handle the video as a photo" = "Chọn hình ảnh cùng video, video sẽ bị mặc nhận thành hình ảnh và gửi đi."; "Select the video when in multi state, we will handle the video as a photo" = "Chọn hình ảnh cùng video, video sẽ bị mặc nhận thành hình ảnh và gửi đi.";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// Created by 谭真 on 15/12/24. // Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved. // Copyright © 2015年 谭真. All rights reserved.
// version 3.3.2 - 2020.05.25 // version 3.4.2 - 2020.08.17
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController // 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
/* /*
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
/// 最小照片必选张数,默认是0 /// 最小照片必选张数,默认是0
@property (nonatomic, assign) NSInteger minImagesCount; @property (nonatomic, assign) NSInteger minImagesCount;
/// If the user does not select any pictures, the current picture is automatically selected when the Finish button is clicked, Default is YES
/// 如果用户未选择任何图片,在点击完成按钮时自动选中当前图片,默认YES
@property (nonatomic, assign) BOOL autoSelectCurrentWhenDone;
/// Always enale the done button, not require minimum 1 photo be picked /// Always enale the done button, not require minimum 1 photo be picked
/// 让完成按钮一直可以点击,无须最少选择一张图片 /// 让完成按钮一直可以点击,无须最少选择一张图片
@property (nonatomic, assign) BOOL alwaysEnableDoneBtn; @property (nonatomic, assign) BOOL alwaysEnableDoneBtn;
...@@ -174,6 +178,7 @@ ...@@ -174,6 +178,7 @@
@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); @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);
@property (nonatomic, copy) void (^videoPreviewPageUIConfigBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton); @property (nonatomic, copy) void (^videoPreviewPageUIConfigBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
@property (nonatomic, copy) void (^gifPreviewPageUIConfigBlock)(UIView *toolBar, UIButton *doneButton); @property (nonatomic, copy) void (^gifPreviewPageUIConfigBlock)(UIView *toolBar, UIButton *doneButton);
@property (nonatomic, copy) void (^albumPickerPageUIConfigBlock)(UITableView *tableView);
@property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView); @property (nonatomic, copy) void (^assetCellDidSetModelBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
@property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel); @property (nonatomic, copy) void (^albumCellDidSetModelBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
/// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等 /// 【自定义各页面/组件的frame】在界面viewDidLayoutSubviews/组件layoutSubviews后调用,允许外界修改frame等
...@@ -181,6 +186,7 @@ ...@@ -181,6 +186,7 @@
@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); @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);
@property (nonatomic, copy) void (^videoPreviewPageDidLayoutSubviewsBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton); @property (nonatomic, copy) void (^videoPreviewPageDidLayoutSubviewsBlock)(UIButton *playButton, UIView *toolBar, UIButton *doneButton);
@property (nonatomic, copy) void (^gifPreviewPageDidLayoutSubviewsBlock)(UIView *toolBar, UIButton *doneButton); @property (nonatomic, copy) void (^gifPreviewPageDidLayoutSubviewsBlock)(UIView *toolBar, UIButton *doneButton);
@property (nonatomic, copy) void (^albumPickerPageDidLayoutSubviewsBlock)(UITableView *tableView);
@property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView); @property (nonatomic, copy) void (^assetCellDidLayoutSubviewsBlock)(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView);
@property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel); @property (nonatomic, copy) void (^albumCellDidLayoutSubviewsBlock)(TZAlbumCell *cell, UIImageView *posterImageView, UILabel *titleLabel);
/// 自定义各页面/组件的frame】刷新底部状态(refreshNaviBarAndBottomBarState)使用的 /// 自定义各页面/组件的frame】刷新底部状态(refreshNaviBarAndBottomBarState)使用的
...@@ -305,6 +311,7 @@ ...@@ -305,6 +311,7 @@
+ (NSDictionary *)tz_getInfoDictionary; + (NSDictionary *)tz_getInfoDictionary;
+ (BOOL)tz_isRightToLeftLayout; + (BOOL)tz_isRightToLeftLayout;
+ (void)configBarButtonItem:(UIBarButtonItem *)item tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc; + (void)configBarButtonItem:(UIBarButtonItem *)item tzImagePickerVc:(TZImagePickerController *)tzImagePickerVc;
+ (BOOL)isICloudSyncError:(NSError *)error;
@end @end
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
// //
// Created by 谭真 on 15/12/24. // Created by 谭真 on 15/12/24.
// Copyright © 2015年 谭真. All rights reserved. // Copyright © 2015年 谭真. All rights reserved.
// version 3.3.2 - 2020.05.25 // version 3.4.2 - 2020.08.17
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController // 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
#import "TZImagePickerController.h" #import "TZImagePickerController.h"
...@@ -263,6 +263,7 @@ ...@@ -263,6 +263,7 @@
} }
- (void)configDefaultSetting { - (void)configDefaultSetting {
self.autoSelectCurrentWhenDone = YES;
self.timeout = 15; self.timeout = 15;
self.photoWidth = 828.0; self.photoWidth = 828.0;
self.photoPreviewMaxWidth = 600; self.photoPreviewMaxWidth = 600;
...@@ -330,6 +331,11 @@ ...@@ -330,6 +331,11 @@
_photoOriginSelImage = [UIImage tz_imageNamedFromMyBundle:photoOriginSelImageName]; _photoOriginSelImage = [UIImage tz_imageNamedFromMyBundle:photoOriginSelImageName];
} }
- (void)setTakePictureImage:(UIImage *)takePictureImage {
_takePictureImage = takePictureImage;
_takePictureImageName = @"";
}
- (void)setIconThemeColor:(UIColor *)iconThemeColor { - (void)setIconThemeColor:(UIColor *)iconThemeColor {
_iconThemeColor = iconThemeColor; _iconThemeColor = iconThemeColor;
[self configDefaultImageName]; [self configDefaultImageName];
...@@ -706,7 +712,7 @@ ...@@ -706,7 +712,7 @@
@end @end
@interface TZAlbumPickerController ()<UITableViewDataSource,UITableViewDelegate> { @interface TZAlbumPickerController ()<UITableViewDataSource, UITableViewDelegate, PHPhotoLibraryChangeObserver> {
UITableView *_tableView; UITableView *_tableView;
} }
@property (nonatomic, strong) NSMutableArray *albumArr; @property (nonatomic, strong) NSMutableArray *albumArr;
...@@ -716,6 +722,7 @@ ...@@ -716,6 +722,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
self.isFirstAppear = YES; self.isFirstAppear = YES;
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
...@@ -780,6 +787,9 @@ ...@@ -780,6 +787,9 @@
self->_tableView.delegate = self; self->_tableView.delegate = self;
[self->_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@"TZAlbumCell"]; [self->_tableView registerClass:[TZAlbumCell class] forCellReuseIdentifier:@"TZAlbumCell"];
[self.view addSubview:self->_tableView]; [self.view addSubview:self->_tableView];
if (imagePickerVc.albumPickerPageUIConfigBlock) {
imagePickerVc.albumPickerPageUIConfigBlock(self->_tableView);
}
} else { } else {
[self->_tableView reloadData]; [self->_tableView reloadData];
} }
...@@ -789,6 +799,7 @@ ...@@ -789,6 +799,7 @@
} }
- (void)dealloc { - (void)dealloc {
[[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];
// NSLog(@"%@ dealloc",NSStringFromClass(self.class)); // NSLog(@"%@ dealloc",NSStringFromClass(self.class));
} }
...@@ -800,6 +811,14 @@ ...@@ -800,6 +811,14 @@
return [super preferredStatusBarStyle]; return [super preferredStatusBarStyle];
} }
#pragma mark - PHPhotoLibraryChangeObserver
- (void)photoLibraryDidChange:(PHChange *)changeInstance {
dispatch_async(dispatch_get_main_queue(), ^{
[self configTableView];
});
}
#pragma mark - Layout #pragma mark - Layout
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
...@@ -818,6 +837,10 @@ ...@@ -818,6 +837,10 @@
tableViewHeight = self.view.tz_height; tableViewHeight = self.view.tz_height;
} }
_tableView.frame = CGRectMake(0, top, self.view.tz_width, tableViewHeight); _tableView.frame = CGRectMake(0, top, self.view.tz_width, tableViewHeight);
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
if (imagePickerVc.albumPickerPageDidLayoutSubviewsBlock) {
imagePickerVc.albumPickerPageDidLayoutSubviewsBlock(_tableView);
}
} }
#pragma mark - UITableViewDataSource && Delegate #pragma mark - UITableViewDataSource && Delegate
...@@ -921,6 +944,14 @@ ...@@ -921,6 +944,14 @@
[item setTitleTextAttributes:textAttrs forState:UIControlStateNormal]; [item setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
} }
+ (BOOL)isICloudSyncError:(NSError *)error {
if (!error) return NO;
if ([error.domain isEqualToString:@"CKErrorDomain"] || [error.domain isEqualToString:@"CloudPhotoLibraryErrorDomain"]) {
return YES;
}
return NO;
}
@end @end
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#import <MobileCoreServices/MobileCoreServices.h> #import <MobileCoreServices/MobileCoreServices.h>
#import "TZImageRequestOperation.h" #import "TZImageRequestOperation.h"
@interface TZPhotoPickerController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate> { @interface TZPhotoPickerController ()<UICollectionViewDataSource,UICollectionViewDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate, PHPhotoLibraryChangeObserver> {
NSMutableArray *_models; NSMutableArray *_models;
UIView *_bottomToolBar; UIView *_bottomToolBar;
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
@property (nonatomic, strong) UIImagePickerController *imagePickerVc; @property (nonatomic, strong) UIImagePickerController *imagePickerVc;
@property (strong, nonatomic) CLLocation *location; @property (strong, nonatomic) CLLocation *location;
@property (nonatomic, strong) NSOperationQueue *operationQueue; @property (nonatomic, strong) NSOperationQueue *operationQueue;
@property (nonatomic, assign) BOOL isSavingMedia;
@end @end
static CGSize AssetGridThumbnailSize; static CGSize AssetGridThumbnailSize;
...@@ -76,6 +77,7 @@ static CGFloat itemMargin = 5; ...@@ -76,6 +77,7 @@ static CGFloat itemMargin = 5;
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
self.isFirstAppear = YES; self.isFirstAppear = YES;
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
_isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto; _isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto;
...@@ -116,16 +118,14 @@ static CGFloat itemMargin = 5; ...@@ -116,16 +118,14 @@ static CGFloat itemMargin = 5;
self->_models = [NSMutableArray arrayWithArray:self->_model.models]; self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews]; [self initSubviews];
}]; }];
} else { } else if (self->_showTakePhotoBtn || self->_isFirstAppear || !self.model.models) {
if (self->_showTakePhotoBtn || self->_isFirstAppear) { [[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) {
[[TZImageManager manager] getAssetsFromFetchResult:self->_model.result completion:^(NSArray<TZAssetModel *> *models) { self->_models = [NSMutableArray arrayWithArray:models];
self->_models = [NSMutableArray arrayWithArray:models];
[self initSubviews];
}];
} else {
self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews]; [self initSubviews];
} }];
} else {
self->_models = [NSMutableArray arrayWithArray:self->_model.models];
[self initSubviews];
} }
}); });
} }
...@@ -163,6 +163,7 @@ static CGFloat itemMargin = 5; ...@@ -163,6 +163,7 @@ static CGFloat itemMargin = 5;
} }
- (void)configCollectionView { - (void)configCollectionView {
_layout = [[UICollectionViewFlowLayout alloc] init]; _layout = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout]; _collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
...@@ -174,6 +175,22 @@ static CGFloat itemMargin = 5; ...@@ -174,6 +175,22 @@ static CGFloat itemMargin = 5;
_collectionView.delegate = self; _collectionView.delegate = self;
_collectionView.alwaysBounceHorizontal = NO; _collectionView.alwaysBounceHorizontal = NO;
_collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin); _collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin);
if (!_collectionView) {
_layout = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[TZCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:_layout];
_collectionView.backgroundColor = [UIColor whiteColor];
_collectionView.dataSource = self;
_collectionView.delegate = self;
_collectionView.alwaysBounceHorizontal = NO;
_collectionView.contentInset = UIEdgeInsetsMake(itemMargin, itemMargin, itemMargin, itemMargin);
[self.view addSubview:_collectionView];
[_collectionView registerClass:[TZAssetCell class] forCellWithReuseIdentifier:@"TZAssetCell"];
[_collectionView registerClass:[TZAssetCameraCell class] forCellWithReuseIdentifier:@"TZAssetCameraCell"];
} else {
[_collectionView reloadData];
}
if (_showTakePhotoBtn) { if (_showTakePhotoBtn) {
_collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width); _collectionView.contentSize = CGSizeMake(self.view.tz_width, ((_model.count + self.columnNumber) / self.columnNumber) * self.view.tz_width);
...@@ -187,11 +204,11 @@ static CGFloat itemMargin = 5; ...@@ -187,11 +204,11 @@ static CGFloat itemMargin = 5;
_noDataLabel.textColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0]; _noDataLabel.textColor = [UIColor colorWithRed:rgb green:rgb blue:rgb alpha:1.0];
_noDataLabel.font = [UIFont boldSystemFontOfSize:20]; _noDataLabel.font = [UIFont boldSystemFontOfSize:20];
[_collectionView addSubview:_noDataLabel]; [_collectionView addSubview:_noDataLabel];
} else if (_noDataLabel) {
[_noDataLabel removeFromSuperview];
_noDataLabel = nil;
} }
} }
[self.view addSubview:_collectionView];
[_collectionView registerClass:[TZAssetCell class] forCellWithReuseIdentifier:@"TZAssetCell"];
[_collectionView registerClass:[TZAssetCameraCell class] forCellWithReuseIdentifier:@"TZAssetCameraCell"];
} }
- (void)viewWillAppear:(BOOL)animated { - (void)viewWillAppear:(BOOL)animated {
...@@ -211,6 +228,7 @@ static CGFloat itemMargin = 5; ...@@ -211,6 +228,7 @@ static CGFloat itemMargin = 5;
- (void)viewDidAppear:(BOOL)animated { - (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated]; [super viewDidAppear:animated];
self.isFirstAppear = NO;
// [self updateCachedAssets]; // [self updateCachedAssets];
} }
...@@ -599,14 +617,25 @@ static CGFloat itemMargin = 5; ...@@ -599,14 +617,25 @@ static CGFloat itemMargin = 5;
[[NSNotificationCenter defaultCenter] postNotificationName:@"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION" object:strongSelf.navigationController]; [[NSNotificationCenter defaultCenter] postNotificationName:@"TZ_PHOTO_PICKER_RELOAD_NOTIFICATION" object:strongSelf.navigationController];
} }
[UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller]; [UIView showOscillatoryAnimationWithLayer:strongLayer type:TZOscillatoryAnimationToSmaller];
if (strongCell.model.iCloudFailed) {
[strongSelf->_models replaceObjectAtIndex:indexPath.item withObject:strongCell.model];
NSString *title = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
[tzImagePickerVc showAlertWithTitle:title];
}
} else { } else {
// 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制 // 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) { if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {
if (tzImagePickerVc.maxImagesCount == 1 && !tzImagePickerVc.allowPreview) { if (!tzImagePickerVc.allowPreview) {
model.isSelected = YES; BOOL shouldDone = tzImagePickerVc.maxImagesCount == 1;
[tzImagePickerVc addSelectedModel:model]; if (!tzImagePickerVc.allowPickingMultipleVideo && (model.type == TZAssetModelMediaTypeVideo || model.type == TZAssetModelMediaTypePhotoGif)) {
[strongSelf doneButtonClick]; shouldDone = YES;
return; }
if (shouldDone) {
model.isSelected = YES;
[tzImagePickerVc addSelectedModel:model];
[strongSelf doneButtonClick];
return;
}
} }
strongCell.selectPhotoButton.selected = YES; strongCell.selectPhotoButton.selected = YES;
model.isSelected = YES; model.isSelected = YES;
...@@ -847,9 +876,14 @@ static CGFloat itemMargin = 5; ...@@ -847,9 +876,14 @@ static CGFloat itemMargin = 5;
UIImage *photo = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *photo = [info objectForKey:UIImagePickerControllerOriginalImage];
NSDictionary *meta = [info objectForKey:UIImagePickerControllerMediaMetadata]; NSDictionary *meta = [info objectForKey:UIImagePickerControllerMediaMetadata];
if (photo) { if (photo) {
self.isSavingMedia = YES;
[[TZImageManager manager] savePhotoWithImage:photo meta:meta location:self.location completion:^(PHAsset *asset, NSError *error){ [[TZImageManager manager] savePhotoWithImage:photo meta:meta location:self.location completion:^(PHAsset *asset, NSError *error){
if (!error) { self.isSavingMedia = NO;
if (!error && asset) {
[self addPHAsset:asset]; [self addPHAsset:asset];
} else {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[tzImagePickerVc hideProgressHUD];
} }
}]; }];
self.location = nil; self.location = nil;
...@@ -859,9 +893,14 @@ static CGFloat itemMargin = 5; ...@@ -859,9 +893,14 @@ static CGFloat itemMargin = 5;
[imagePickerVc showProgressHUD]; [imagePickerVc showProgressHUD];
NSURL *videoUrl = [info objectForKey:UIImagePickerControllerMediaURL]; NSURL *videoUrl = [info objectForKey:UIImagePickerControllerMediaURL];
if (videoUrl) { if (videoUrl) {
self.isSavingMedia = YES;
[[TZImageManager manager] saveVideoWithUrl:videoUrl location:self.location completion:^(PHAsset *asset, NSError *error) { [[TZImageManager manager] saveVideoWithUrl:videoUrl location:self.location completion:^(PHAsset *asset, NSError *error) {
if (!error) { self.isSavingMedia = NO;
if (!error && asset) {
[self addPHAsset:asset]; [self addPHAsset:asset];
} else {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[tzImagePickerVc hideProgressHUD];
} }
}]; }];
self.location = nil; self.location = nil;
...@@ -917,10 +956,23 @@ static CGFloat itemMargin = 5; ...@@ -917,10 +956,23 @@ static CGFloat itemMargin = 5;
} }
- (void)dealloc { - (void)dealloc {
[[PHPhotoLibrary sharedPhotoLibrary] unregisterChangeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
// NSLog(@"%@ dealloc",NSStringFromClass(self.class)); // NSLog(@"%@ dealloc",NSStringFromClass(self.class));
} }
#pragma mark - PHPhotoLibraryChangeObserver
- (void)photoLibraryDidChange:(PHChange *)changeInstance {
if (self.isSavingMedia) {
return;
}
dispatch_async(dispatch_get_main_queue(), ^{
[self.model refreshFetchResult];
[self fetchAssetModels];
});
}
#pragma mark - Asset Caching #pragma mark - Asset Caching
- (void)resetCachedAssets { - (void)resetCachedAssets {
......
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
@property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *imageContainerView; @property (nonatomic, strong) UIView *imageContainerView;
@property (nonatomic, strong) TZProgressView *progressView; @property (nonatomic, strong) TZProgressView *progressView;
@property (nonatomic, strong) UIImageView *iCloudErrorIcon;
@property (nonatomic, strong) UILabel *iCloudErrorLabel;
@property (nonatomic, copy) void (^iCloudSyncFailedHandle)(id asset, BOOL isSyncFailed);
@property (nonatomic, assign) BOOL allowCrop; @property (nonatomic, assign) BOOL allowCrop;
@property (nonatomic, assign) CGRect cropRect; @property (nonatomic, assign) CGRect cropRect;
...@@ -60,6 +64,9 @@ ...@@ -60,6 +64,9 @@
@property (strong, nonatomic) UIButton *playButton; @property (strong, nonatomic) UIButton *playButton;
@property (strong, nonatomic) UIImage *cover; @property (strong, nonatomic) UIImage *cover;
@property (nonatomic, strong) NSURL *videoURL; @property (nonatomic, strong) NSURL *videoURL;
@property (nonatomic, strong) UIImageView *iCloudErrorIcon;
@property (nonatomic, strong) UILabel *iCloudErrorLabel;
@property (nonatomic, copy) void (^iCloudSyncFailedHandle)(id asset, BOOL isSyncFailed);
- (void)pausePlayerAndShowNaviBar; - (void)pausePlayerAndShowNaviBar;
@end @end
......
...@@ -61,12 +61,12 @@ ...@@ -61,12 +61,12 @@
strongSelf.imageProgressUpdateBlock(progress); strongSelf.imageProgressUpdateBlock(progress);
} }
}]; }];
[self addSubview:self.previewView]; [self.contentView addSubview:self.previewView];
} }
- (void)setModel:(TZAssetModel *)model { - (void)setModel:(TZAssetModel *)model {
[super setModel:model]; [super setModel:model];
_previewView.asset = model.asset; _previewView.model = model;
} }
- (void)recoverSubviews { - (void)recoverSubviews {
...@@ -133,6 +133,17 @@ ...@@ -133,6 +133,17 @@
_imageView.contentMode = UIViewContentModeScaleAspectFill; _imageView.contentMode = UIViewContentModeScaleAspectFill;
_imageView.clipsToBounds = YES; _imageView.clipsToBounds = YES;
[_imageContainerView addSubview:_imageView]; [_imageContainerView addSubview:_imageView];
_iCloudErrorIcon = [[UIImageView alloc] init];
_iCloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
_iCloudErrorIcon.hidden = YES;
[self addSubview:_iCloudErrorIcon];
_iCloudErrorLabel = [[UILabel alloc] init];
_iCloudErrorLabel.font = [UIFont systemFontOfSize:10];
_iCloudErrorLabel.textColor = [UIColor whiteColor];
_iCloudErrorLabel.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
_iCloudErrorLabel.hidden = YES;
[self addSubview:_iCloudErrorLabel];
UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)]; UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
[self addGestureRecognizer:tap1]; [self addGestureRecognizer:tap1];
...@@ -159,7 +170,9 @@ ...@@ -159,7 +170,9 @@
if (model.type == TZAssetModelMediaTypePhotoGif) { if (model.type == TZAssetModelMediaTypePhotoGif) {
// 先显示缩略图 // 先显示缩略图
[[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
self.imageView.image = photo; if (photo) {
self.imageView.image = photo;
}
[self resizeSubviews]; [self resizeSubviews];
if (self.isRequestingGIF) { if (self.isRequestingGIF) {
return; return;
...@@ -169,6 +182,13 @@ ...@@ -169,6 +182,13 @@
[[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) { [[TZImageManager manager] getOriginalPhotoDataWithAsset:model.asset progressHandler:^(double progress, NSError *error, BOOL *stop, NSDictionary *info) {
progress = progress > 0.02 ? progress : 0.02; progress = progress > 0.02 ? progress : 0.02;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
BOOL iCloudSyncFailed = [TZCommonTools isICloudSyncError:error];
self.iCloudErrorLabel.hidden = !iCloudSyncFailed;
self.iCloudErrorIcon.hidden = !iCloudSyncFailed;
if (self.iCloudSyncFailedHandle) {
self.iCloudSyncFailedHandle(model.asset, iCloudSyncFailed);
}
self.progressView.progress = progress; self.progressView.progress = progress;
if (progress >= 1) { if (progress >= 1) {
self.progressView.hidden = YES; self.progressView.hidden = YES;
...@@ -204,8 +224,16 @@ ...@@ -204,8 +224,16 @@
_asset = asset; _asset = asset;
self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { self.imageRequestID = [[TZImageManager manager] getPhotoWithAsset:asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.iCloudErrorLabel.hidden = !iCloudSyncFailed;
self.iCloudErrorIcon.hidden = !iCloudSyncFailed;
if (self.iCloudSyncFailedHandle) {
self.iCloudSyncFailedHandle(asset, iCloudSyncFailed);
}
if (![asset isEqual:self->_asset]) return; if (![asset isEqual:self->_asset]) return;
self.imageView.image = photo; if (photo) {
self.imageView.image = photo;
}
[self resizeSubviews]; [self resizeSubviews];
if (self.imageView.tz_height && self.allowCrop) { if (self.imageView.tz_height && self.allowCrop) {
CGFloat scale = MAX(self.cropRect.size.width / self.imageView.tz_width, self.cropRect.size.height / self.imageView.tz_height); CGFloat scale = MAX(self.cropRect.size.width / self.imageView.tz_width, self.cropRect.size.height / self.imageView.tz_height);
...@@ -216,7 +244,7 @@ ...@@ -216,7 +244,7 @@
[self.scrollView setZoomScale:scale animated:YES]; [self.scrollView setZoomScale:scale animated:YES];
} }
} }
self->_progressView.hidden = YES; self->_progressView.hidden = YES;
if (self.imageProgressUpdateBlock) { if (self.imageProgressUpdateBlock) {
self.imageProgressUpdateBlock(1); self.imageProgressUpdateBlock(1);
...@@ -313,8 +341,9 @@ ...@@ -313,8 +341,9 @@
CGFloat progressX = (self.tz_width - progressWH) / 2; CGFloat progressX = (self.tz_width - progressWH) / 2;
CGFloat progressY = (self.tz_height - progressWH) / 2; CGFloat progressY = (self.tz_height - progressWH) / 2;
_progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH); _progressView.frame = CGRectMake(progressX, progressY, progressWH, progressWH);
[self recoverSubviews]; [self recoverSubviews];
_iCloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, 28, 28);
_iCloudErrorLabel.frame = CGRectMake(53, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.tz_width - 63, 28);
} }
#pragma mark - UITapGestureRecognizer Event #pragma mark - UITapGestureRecognizer Event
...@@ -371,6 +400,14 @@ ...@@ -371,6 +400,14 @@
- (void)configSubviews { - (void)configSubviews {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];
_iCloudErrorIcon = [[UIImageView alloc] init];
_iCloudErrorIcon.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
_iCloudErrorIcon.hidden = YES;
_iCloudErrorLabel = [[UILabel alloc] init];
_iCloudErrorLabel.font = [UIFont systemFontOfSize:10];
_iCloudErrorLabel.textColor = [UIColor whiteColor];
_iCloudErrorLabel.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
_iCloudErrorLabel.hidden = YES;
} }
- (void)configPlayButton { - (void)configPlayButton {
...@@ -381,7 +418,9 @@ ...@@ -381,7 +418,9 @@
[_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@"MMVideoPreviewPlay"] forState:UIControlStateNormal]; [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@"MMVideoPreviewPlay"] forState:UIControlStateNormal];
[_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@"MMVideoPreviewPlayHL"] forState:UIControlStateHighlighted]; [_playButton setImage:[UIImage tz_imageNamedFromMyBundle:@"MMVideoPreviewPlayHL"] forState:UIControlStateHighlighted];
[_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside]; [_playButton addTarget:self action:@selector(playButtonClick) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_playButton]; [self.contentView addSubview:_playButton];
[self.contentView addSubview:_iCloudErrorIcon];
[self.contentView addSubview:_iCloudErrorLabel];
} }
- (void)setModel:(TZAssetModel *)model { - (void)setModel:(TZAssetModel *)model {
...@@ -404,10 +443,24 @@ ...@@ -404,10 +443,24 @@
if (self.model && self.model.asset) { if (self.model && self.model.asset) {
[[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:self.model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
self.cover = photo; BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.iCloudErrorLabel.hidden = !iCloudSyncFailed;
self.iCloudErrorIcon.hidden = !iCloudSyncFailed;
if (self.iCloudSyncFailedHandle) {
self.iCloudSyncFailedHandle(self.model.asset, iCloudSyncFailed);
}
if (photo) {
self.cover = photo;
}
}]; }];
[[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) { [[TZImageManager manager] getVideoWithAsset:self.model.asset completion:^(AVPlayerItem *playerItem, NSDictionary *info) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
BOOL iCloudSyncFailed = !playerItem && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.iCloudErrorLabel.hidden = !iCloudSyncFailed;
self.iCloudErrorIcon.hidden = !iCloudSyncFailed;
if (self.iCloudSyncFailedHandle) {
self.iCloudSyncFailedHandle(self.model.asset, iCloudSyncFailed);
}
[self configPlayerWithItem:playerItem]; [self configPlayerWithItem:playerItem];
}); });
}]; }];
...@@ -431,6 +484,8 @@ ...@@ -431,6 +484,8 @@
[super layoutSubviews]; [super layoutSubviews];
_playerLayer.frame = self.bounds; _playerLayer.frame = self.bounds;
_playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44); _playButton.frame = CGRectMake(0, 64, self.tz_width, self.tz_height - 64 - 44);
_iCloudErrorIcon.frame = CGRectMake(20, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, 28, 28);
_iCloudErrorLabel.frame = CGRectMake(53, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.tz_width - 63, 28);
} }
- (void)photoPreviewCollectionViewDidScroll { - (void)photoPreviewCollectionViewDidScroll {
...@@ -489,7 +544,7 @@ ...@@ -489,7 +544,7 @@
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
[strongSelf signleTapAction]; [strongSelf signleTapAction];
}]; }];
[self addSubview:_previewView]; [self.contentView addSubview:_previewView];
} }
- (void)setModel:(TZAssetModel *)model { - (void)setModel:(TZAssetModel *)model {
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
@property (nonatomic, assign) double progress; @property (nonatomic, assign) double progress;
@property (strong, nonatomic) UIAlertController *alertView; @property (strong, nonatomic) UIAlertController *alertView;
@property (nonatomic, strong) UIView *iCloudErrorView;
@end @end
@implementation TZPhotoPreviewController @implementation TZPhotoPreviewController
...@@ -382,7 +383,7 @@ ...@@ -382,7 +383,7 @@
} }
// 如果没有选中过照片 点击确定时选中当前预览的照片 // 如果没有选中过照片 点击确定时选中当前预览的照片
if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0) { if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0 && _tzImagePickerVc.autoSelectCurrentWhenDone) {
[self select:_selectButton]; [self select:_selectButton];
} }
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0];
...@@ -441,7 +442,6 @@ ...@@ -441,7 +442,6 @@
_currentIndex = currentIndex; _currentIndex = currentIndex;
[self refreshNaviBarAndBottomBarState]; [self refreshNaviBarAndBottomBarState];
} }
[[NSNotificationCenter defaultCenter] postNotificationName:@"photoPreviewCollectionViewDidScroll" object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"photoPreviewCollectionViewDidScroll" object:nil];
} }
...@@ -459,8 +459,20 @@ ...@@ -459,8 +459,20 @@
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) { if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypeVideo) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZVideoPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZVideoPreviewCell" forIndexPath:indexPath];
TZVideoPreviewCell *currentCell = (TZVideoPreviewCell *)cell;
currentCell.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {
model.iCloudFailed = isSyncFailed;
[weakSelf didICloudSyncStatusChanged:model];
[weakSelf.models replaceObjectAtIndex:indexPath.item withObject:model];
};
} else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) { } else if (_tzImagePickerVc.allowPickingMultipleVideo && model.type == TZAssetModelMediaTypePhotoGif && _tzImagePickerVc.allowPickingGif) {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZGifPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZGifPreviewCell" forIndexPath:indexPath];
TZGifPreviewCell *currentCell = (TZGifPreviewCell *)cell;
currentCell.previewView.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {
model.iCloudFailed = isSyncFailed;
[weakSelf didICloudSyncStatusChanged:model];
[weakSelf.models replaceObjectAtIndex:indexPath.item withObject:model];
};
} else { } else {
cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZPhotoPreviewCell" forIndexPath:indexPath]; cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"TZPhotoPreviewCell" forIndexPath:indexPath];
TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell; TZPhotoPreviewCell *photoPreviewCell = (TZPhotoPreviewCell *)cell;
...@@ -485,6 +497,11 @@ ...@@ -485,6 +497,11 @@
} }
} }
}]; }];
photoPreviewCell.previewView.iCloudSyncFailedHandle = ^(id asset, BOOL isSyncFailed) {
model.iCloudFailed = isSyncFailed;
[weakSelf didICloudSyncStatusChanged:model];
[weakSelf.models replaceObjectAtIndex:indexPath.item withObject:model];
};
} }
cell.model = model; cell.model = model;
...@@ -492,6 +509,7 @@ ...@@ -492,6 +509,7 @@
__strong typeof(weakSelf) strongSelf = weakSelf; __strong typeof(weakSelf) strongSelf = weakSelf;
[strongSelf didTapPreviewCell]; [strongSelf didTapPreviewCell];
}]; }];
return cell; return cell;
} }
...@@ -562,7 +580,8 @@ ...@@ -562,7 +580,8 @@
_originalPhotoLabel.hidden = YES; _originalPhotoLabel.hidden = YES;
_doneButton.hidden = YES; _doneButton.hidden = YES;
} }
// iCloud同步失败的UI刷新
[self didICloudSyncStatusChanged:model];
if (_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock) { if (_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock) {
_tzImagePickerVc.photoPreviewPageDidRefreshStateBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel); _tzImagePickerVc.photoPreviewPageDidRefreshStateBlock(_collectionView, _naviBar, _backButton, _selectButton, _indexLabel, _toolBar, _originalPhotoButton, _originalPhotoLabel, _doneButton, _numberImageView, _numberLabel);
} }
...@@ -578,6 +597,25 @@ ...@@ -578,6 +597,25 @@
}); });
} }
- (void)didICloudSyncStatusChanged:(TZAssetModel *)model{
dispatch_async(dispatch_get_main_queue(), ^{
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
// onlyReturnAsset为NO时,依赖TZ返回大图,所以需要有iCloud同步失败的提示,并且不能选择,
if (_tzImagePickerVc.onlyReturnAsset) {
return;
}
TZAssetModel *currentModel = self.models[self.currentIndex];
if (_tzImagePickerVc.selectedModels.count <= 0) {
self->_doneButton.enabled = !currentModel.iCloudFailed;
} else {
self->_doneButton.enabled = YES;
}
self->_selectButton.hidden = currentModel.iCloudFailed || !_tzImagePickerVc.showSelectBtn;
self->_originalPhotoButton.hidden = currentModel.iCloudFailed;
self->_originalPhotoLabel.hidden = currentModel.iCloudFailed;
});
}
- (void)showPhotoBytes { - (void)showPhotoBytes {
[[TZImageManager manager] getPhotosBytesWithArray:@[_models[self.currentIndex]] completion:^(NSString *totalBytes) { [[TZImageManager manager] getPhotosBytesWithArray:@[_models[self.currentIndex]] completion:^(NSString *totalBytes) {
self->_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes]; self->_originalPhotoLabel.text = [NSString stringWithFormat:@"(%@)",totalBytes];
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
} }
@property (assign, nonatomic) BOOL needShowStatusBar; @property (assign, nonatomic) BOOL needShowStatusBar;
// iCloud无法同步提示UI
@property (nonatomic, strong) UIView *iCloudErrorView;
@end @end
#pragma clang diagnostic push #pragma clang diagnostic push
...@@ -63,6 +66,8 @@ ...@@ -63,6 +66,8 @@
- (void)configMoviePlayer { - (void)configMoviePlayer {
[[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) { [[TZImageManager manager] getPhotoWithAsset:_model.asset completion:^(UIImage *photo, NSDictionary *info, BOOL isDegraded) {
BOOL iCloudSyncFailed = !photo && [TZCommonTools isICloudSyncError:info[PHImageErrorKey]];
self.iCloudErrorView.hidden = !iCloudSyncFailed;
if (!isDegraded && photo) { if (!isDegraded && photo) {
self->_cover = photo; self->_cover = photo;
self->_doneButton.enabled = YES; self->_doneButton.enabled = YES;
...@@ -216,6 +221,26 @@ ...@@ -216,6 +221,26 @@
} }
} }
#pragma mark - lazy
- (UIView *)iCloudErrorView{
if (!_iCloudErrorView) {
_iCloudErrorView = [[UIView alloc] initWithFrame:CGRectMake(0, [TZCommonTools tz_isIPhoneX] ? 88 + 10 : 64 + 10, self.view.tz_width, 28)];
UIImageView *icloud = [[UIImageView alloc] init];
icloud.image = [UIImage tz_imageNamedFromMyBundle:@"iCloudError"];
icloud.frame = CGRectMake(20, 0, 28, 28);
[_iCloudErrorView addSubview:icloud];
UILabel *label = [[UILabel alloc] init];
label.frame = CGRectMake(53, 0, self.view.tz_width - 63, 28);
label.font = [UIFont systemFontOfSize:10];
label.textColor = [UIColor whiteColor];
label.text = [NSBundle tz_localizedStringForKey:@"iCloud sync failed"];
[_iCloudErrorView addSubview:label];
[self.view addSubview:_iCloudErrorView];
_iCloudErrorView.hidden = YES;
}
return _iCloudErrorView;
}
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
} }
......
...@@ -213,6 +213,7 @@ ...@@ -213,6 +213,7 @@
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.item]; TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.item];
imagePickerVc.maxImagesCount = self.maxCountTF.text.integerValue; imagePickerVc.maxImagesCount = self.maxCountTF.text.integerValue;
imagePickerVc.allowPickingGif = self.allowPickingGifSwitch.isOn; imagePickerVc.allowPickingGif = self.allowPickingGifSwitch.isOn;
imagePickerVc.autoSelectCurrentWhenDone = NO;
imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn; imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn;
imagePickerVc.allowPickingMultipleVideo = self.allowPickingMuitlpleVideoSwitch.isOn; imagePickerVc.allowPickingMultipleVideo = self.allowPickingMuitlpleVideoSwitch.isOn;
imagePickerVc.showSelectedIndex = self.showSelectedIndexSwitch.isOn; imagePickerVc.showSelectedIndex = self.showSelectedIndexSwitch.isOn;
...@@ -259,6 +260,9 @@ ...@@ -259,6 +260,9 @@
if (self.maxCountTF.text.integerValue <= 0) { if (self.maxCountTF.text.integerValue <= 0) {
return; return;
} }
// 设置languageBundle以使用其它语言,必须在TZImagePickerController初始化前设置 / Set languageBundle to use other language
// [TZImagePickerConfig sharedInstance].languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]];
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:self.maxCountTF.text.integerValue columnNumber:self.columnNumberTF.text.integerValue delegate:self pushPhotoPickerVc:YES]; TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:self.maxCountTF.text.integerValue columnNumber:self.columnNumberTF.text.integerValue delegate:self pushPhotoPickerVc:YES];
// imagePickerVc.barItemTextColor = [UIColor blackColor]; // imagePickerVc.barItemTextColor = [UIColor blackColor];
// [imagePickerVc.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}]; // [imagePickerVc.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor blackColor]}];
...@@ -279,6 +283,7 @@ ...@@ -279,6 +283,7 @@
[imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) { [imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) {
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh; imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
}]; }];
// imagePickerVc.autoSelectCurrentWhenDone = NO;
// imagePickerVc.photoWidth = 1600; // imagePickerVc.photoWidth = 1600;
// imagePickerVc.photoPreviewMaxWidth = 1600; // imagePickerVc.photoPreviewMaxWidth = 1600;
...@@ -292,9 +297,11 @@ ...@@ -292,9 +297,11 @@
imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0]; imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];
imagePickerVc.showPhotoCannotSelectLayer = YES; imagePickerVc.showPhotoCannotSelectLayer = YES;
imagePickerVc.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8]; imagePickerVc.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];
/*
[imagePickerVc setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { [imagePickerVc setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {
[doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}]; }];
*/
/* /*
[imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { [imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
cell.contentView.clipsToBounds = YES; cell.contentView.clipsToBounds = YES;
...@@ -338,7 +345,7 @@ ...@@ -338,7 +345,7 @@
cropView.layer.borderWidth = 2.0; cropView.layer.borderWidth = 2.0;
}];*/ }];*/
//imagePickerVc.allowPreview = NO; // imagePickerVc.allowPreview = NO;
// 自定义导航栏上的返回按钮 // 自定义导航栏上的返回按钮
/* /*
[imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){ [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){
...@@ -380,9 +387,6 @@ ...@@ -380,9 +387,6 @@
// 设置首选语言 / Set preferred language // 设置首选语言 / Set preferred language
// imagePickerVc.preferredLanguage = @"zh-Hans"; // imagePickerVc.preferredLanguage = @"zh-Hans";
// 设置languageBundle以使用其它语言 / Set languageBundle to use other language
// imagePickerVc.languageBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"tz-ru" ofType:@"lproj"]];
#pragma mark - 到这里为止 #pragma mark - 到这里为止
// You can get the photos by block, the same as by delegate. // You can get the photos by block, the same as by delegate.
...@@ -527,11 +531,6 @@ ...@@ -527,11 +531,6 @@
[_selectedAssets addObject:asset]; [_selectedAssets addObject:asset];
[_selectedPhotos addObject:image]; [_selectedPhotos addObject:image];
[_collectionView reloadData]; [_collectionView reloadData];
if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = asset;
NSLog(@"location:%@",phAsset.location);
}
} }
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment