Commit 6474f681 authored by yuzheng.tz's avatar yuzheng.tz

优化性能,提高选择器打开速度;发布2.0.0.3版本

parent 7b51c36b
...@@ -93,6 +93,7 @@ A:1.8.4版本已支持 ...@@ -93,6 +93,7 @@ A:1.8.4版本已支持
A:考虑下,优先级低 A:考虑下,优先级低
最近更新 最近更新
2.0.0.3 优化性能,提高选择器打开速度,新增越南语支持
2.0.0.2 新增繁体语言,可设置首选语言,国际化支持更强大;优化一些细节 2.0.0.2 新增繁体语言,可设置首选语言,国际化支持更强大;优化一些细节
1.9.8 支持Carthage,优化一些细节 1.9.8 支持Carthage,优化一些细节
1.9.6 优化视频预览和gif预览页toolbar在iPhoneX上的样式 1.9.6 优化视频预览和gif预览页toolbar在iPhoneX上的样式
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "TZImagePickerController" s.name = "TZImagePickerController"
s.version = "2.0.0.2" s.version = "2.0.0.3"
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 = "6.0" s.ios.deployment_target = "6.0"
s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "2.0.0.2" } s.source = { :git => "https://github.com/banchichen/TZImagePickerController.git", :tag => "2.0.0.3" }
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}"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>2.0.0.2</string> <string>2.0.0.3</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -46,4 +46,6 @@ typedef enum : NSUInteger { ...@@ -46,4 +46,6 @@ typedef enum : NSUInteger {
@property (nonatomic, assign) BOOL isCameraRoll; @property (nonatomic, assign) BOOL isCameraRoll;
- (void)setResult:(id)result needFetchAssets:(BOOL)needFetchAssets;
@end @end
...@@ -31,14 +31,16 @@ ...@@ -31,14 +31,16 @@
@implementation TZAlbumModel @implementation TZAlbumModel
- (void)setResult:(id)result { - (void)setResult:(id)result needFetchAssets:(BOOL)needFetchAssets {
_result = result; _result = result;
if (needFetchAssets) {
[[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:result completion:^(NSArray<TZAssetModel *> *models) {
_models = models; _models = models;
if (_selectedModels) { if (_selectedModels) {
[self checkSelectedModels]; [self checkSelectedModels];
} }
}]; }];
}
} }
- (void)setSelectedModels:(NSArray *)selectedModels { - (void)setSelectedModels:(NSArray *)selectedModels {
......
...@@ -50,8 +50,8 @@ ...@@ -50,8 +50,8 @@
- (void)requestAuthorizationWithCompletion:(void (^)(void))completion; - (void)requestAuthorizationWithCompletion:(void (^)(void))completion;
/// Get Album 获得相册/相册数组 /// Get Album 获得相册/相册数组
- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAlbumModel *model))completion; - (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion;
- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAlbumModel *> *models))completion; - (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *models))completion;
/// Get Assets 获得Asset数组 /// Get Assets 获得Asset数组
- (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<TZAssetModel *> *models))completion; - (void)getAssetsFromFetchResult:(id)result completion:(void (^)(NSArray<TZAssetModel *> *models))completion;
......
...@@ -121,7 +121,7 @@ static dispatch_once_t onceToken; ...@@ -121,7 +121,7 @@ static dispatch_once_t onceToken;
#pragma mark - Get Album #pragma mark - Get Album
/// Get Album 获得相册/相册数组 /// Get Album 获得相册/相册数组
- (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(TZAlbumModel *))completion{ - (void)getCameraRollAlbum:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(TZAlbumModel *model))completion {
__block TZAlbumModel *model; __block TZAlbumModel *model;
if (iOS8Later) { if (iOS8Later) {
PHFetchOptions *option = [[PHFetchOptions alloc] init]; PHFetchOptions *option = [[PHFetchOptions alloc] init];
...@@ -138,7 +138,7 @@ static dispatch_once_t onceToken; ...@@ -138,7 +138,7 @@ static dispatch_once_t onceToken;
if (![collection isKindOfClass:[PHAssetCollection class]]) continue; if (![collection isKindOfClass:[PHAssetCollection class]]) 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]; model = [self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:YES needFetchAssets:needFetchAssets];
if (completion) completion(model); if (completion) completion(model);
break; break;
} }
...@@ -148,7 +148,7 @@ static dispatch_once_t onceToken; ...@@ -148,7 +148,7 @@ static dispatch_once_t onceToken;
if ([group numberOfAssets] < 1) return; if ([group numberOfAssets] < 1) return;
if ([self isCameraRollAlbum:group]) { if ([self isCameraRollAlbum:group]) {
NSString *name = [group valueForProperty:ALAssetsGroupPropertyName]; NSString *name = [group valueForProperty:ALAssetsGroupPropertyName];
model = [self modelWithResult:group name:name isCameraRoll:YES]; model = [self modelWithResult:group name:name isCameraRoll:YES needFetchAssets:needFetchAssets];
if (completion) completion(model); if (completion) completion(model);
*stop = YES; *stop = YES;
} }
...@@ -156,7 +156,7 @@ static dispatch_once_t onceToken; ...@@ -156,7 +156,7 @@ static dispatch_once_t onceToken;
} }
} }
- (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage completion:(void (^)(NSArray<TZAlbumModel *> *))completion{ - (void)getAllAlbums:(BOOL)allowPickingVideo allowPickingImage:(BOOL)allowPickingImage needFetchAssets:(BOOL)needFetchAssets completion:(void (^)(NSArray<TZAlbumModel *> *))completion{
NSMutableArray *albumArr = [NSMutableArray array]; NSMutableArray *albumArr = [NSMutableArray array];
if (iOS8Later) { if (iOS8Later) {
PHFetchOptions *option = [[PHFetchOptions alloc] init]; PHFetchOptions *option = [[PHFetchOptions alloc] init];
...@@ -190,9 +190,9 @@ static dispatch_once_t onceToken; ...@@ -190,9 +190,9 @@ static dispatch_once_t onceToken;
if ([collection.localizedTitle tz_containsString:@"Hidden"] || [collection.localizedTitle isEqualToString:@"已隐藏"]) continue; if ([collection.localizedTitle tz_containsString:@"Hidden"] || [collection.localizedTitle isEqualToString:@"已隐藏"]) continue;
if ([collection.localizedTitle tz_containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue; if ([collection.localizedTitle tz_containsString:@"Deleted"] || [collection.localizedTitle isEqualToString:@"最近删除"]) continue;
if ([self isCameraRollAlbum:collection]) { if ([self isCameraRollAlbum:collection]) {
[albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:YES] atIndex:0]; [albumArr insertObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:YES needFetchAssets:needFetchAssets] atIndex:0];
} else { } else {
[albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:NO]]; [albumArr addObject:[self modelWithResult:fetchResult name:collection.localizedTitle isCameraRoll:NO needFetchAssets:needFetchAssets]];
} }
} }
} }
...@@ -212,15 +212,15 @@ static dispatch_once_t onceToken; ...@@ -212,15 +212,15 @@ static dispatch_once_t onceToken;
} }
if ([self isCameraRollAlbum:group]) { if ([self isCameraRollAlbum:group]) {
[albumArr insertObject:[self modelWithResult:group name:name isCameraRoll:YES] atIndex:0]; [albumArr insertObject:[self modelWithResult:group name:name isCameraRoll:YES needFetchAssets:needFetchAssets] atIndex:0];
} else if ([name isEqualToString:@"My Photo Stream"] || [name isEqualToString:@"我的照片流"]) { } else if ([name isEqualToString:@"My Photo Stream"] || [name isEqualToString:@"我的照片流"]) {
if (albumArr.count) { if (albumArr.count) {
[albumArr insertObject:[self modelWithResult:group name:name isCameraRoll:NO] atIndex:1]; [albumArr insertObject:[self modelWithResult:group name:name isCameraRoll:NO needFetchAssets:needFetchAssets] atIndex:1];
} else { } else {
[albumArr addObject:[self modelWithResult:group name:name isCameraRoll:NO]]; [albumArr addObject:[self modelWithResult:group name:name isCameraRoll:NO needFetchAssets:needFetchAssets]];
} }
} else { } else {
[albumArr addObject:[self modelWithResult:group name:name isCameraRoll:NO]]; [albumArr addObject:[self modelWithResult:group name:name isCameraRoll:NO needFetchAssets:needFetchAssets]];
} }
} failureBlock:nil]; } failureBlock:nil];
} }
...@@ -655,7 +655,7 @@ static dispatch_once_t onceToken; ...@@ -655,7 +655,7 @@ static dispatch_once_t onceToken;
request.creationDate = [NSDate date]; request.creationDate = [NSDate date];
} }
} completionHandler:^(BOOL success, NSError *error) { } completionHandler:^(BOOL success, NSError *error) {
dispatch_sync(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (success && completion) { if (success && completion) {
completion(nil); completion(nil);
} else if (error) { } else if (error) {
...@@ -902,9 +902,9 @@ static dispatch_once_t onceToken; ...@@ -902,9 +902,9 @@ static dispatch_once_t onceToken;
#pragma mark - Private Method #pragma mark - Private Method
- (TZAlbumModel *)modelWithResult:(id)result name:(NSString *)name isCameraRoll:(BOOL)isCameraRoll { - (TZAlbumModel *)modelWithResult:(id)result name:(NSString *)name isCameraRoll:(BOOL)isCameraRoll needFetchAssets:(BOOL)needFetchAssets {
TZAlbumModel *model = [[TZAlbumModel alloc] init]; TZAlbumModel *model = [[TZAlbumModel alloc] init];
model.result = result; [model setResult:result needFetchAssets:needFetchAssets];
model.name = name; model.name = name;
model.isCameraRoll = isCameraRoll; model.isCameraRoll = isCameraRoll;
if ([result isKindOfClass:[PHFetchResult class]]) { if ([result isKindOfClass:[PHFetchResult class]]) {
......
...@@ -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 2.0.0.2 - 2018.01.26 // version 2.0.0.3 - 2018.01.29
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController // 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
/* /*
...@@ -234,6 +234,7 @@ ...@@ -234,6 +234,7 @@
@interface TZAlbumPickerController : UIViewController @interface TZAlbumPickerController : UIViewController
@property (nonatomic, assign) NSInteger columnNumber; @property (nonatomic, assign) NSInteger columnNumber;
@property (assign, nonatomic) BOOL isFirstAppear;
- (void)configTableView; - (void)configTableView;
@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 2.0.0.2 - 2018.01.26 // version 2.0.0.3 - 2018.01.29
// 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController // 更多信息,请前往项目的github地址:https://github.com/banchichen/TZImagePickerController
#import "TZImagePickerController.h" #import "TZImagePickerController.h"
...@@ -156,6 +156,7 @@ ...@@ -156,6 +156,7 @@
- (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc { - (instancetype)initWithMaxImagesCount:(NSInteger)maxImagesCount columnNumber:(NSInteger)columnNumber delegate:(id<TZImagePickerControllerDelegate>)delegate pushPhotoPickerVc:(BOOL)pushPhotoPickerVc {
_pushPhotoPickerVc = pushPhotoPickerVc; _pushPhotoPickerVc = pushPhotoPickerVc;
TZAlbumPickerController *albumPickerVc = [[TZAlbumPickerController alloc] init]; TZAlbumPickerController *albumPickerVc = [[TZAlbumPickerController alloc] init];
albumPickerVc.isFirstAppear = YES;
albumPickerVc.columnNumber = columnNumber; albumPickerVc.columnNumber = columnNumber;
self = [super initWithRootViewController:albumPickerVc]; self = [super initWithRootViewController:albumPickerVc];
if (self) { if (self) {
...@@ -303,6 +304,11 @@ ...@@ -303,6 +304,11 @@
[_timer invalidate]; [_timer invalidate];
_timer = nil; _timer = nil;
[self pushPhotoPickerVc]; [self pushPhotoPickerVc];
TZAlbumPickerController *albumPickerVc = (TZAlbumPickerController *)self.visibleViewController;
if ([albumPickerVc isKindOfClass:[TZAlbumPickerController class]]) {
[albumPickerVc configTableView];
}
} }
} }
...@@ -313,17 +319,12 @@ ...@@ -313,17 +319,12 @@
TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init]; TZPhotoPickerController *photoPickerVc = [[TZPhotoPickerController alloc] init];
photoPickerVc.isFirstAppear = YES; photoPickerVc.isFirstAppear = YES;
photoPickerVc.columnNumber = self.columnNumber; photoPickerVc.columnNumber = self.columnNumber;
[[TZImageManager manager] getCameraRollAlbum:self.allowPickingVideo allowPickingImage:self.allowPickingImage completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:self.allowPickingVideo allowPickingImage:self.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) {
photoPickerVc.model = model; photoPickerVc.model = model;
[self pushViewController:photoPickerVc animated:YES]; [self pushViewController:photoPickerVc animated:YES];
_didPushPhotoPickerVc = YES; _didPushPhotoPickerVc = YES;
}]; }];
} }
TZAlbumPickerController *albumPickerVc = (TZAlbumPickerController *)self.visibleViewController;
if ([albumPickerVc isKindOfClass:[TZAlbumPickerController class]]) {
[albumPickerVc configTableView];
}
} }
- (id)showAlertWithTitle:(NSString *)title { - (id)showAlertWithTitle:(NSString *)title {
...@@ -595,7 +596,6 @@ ...@@ -595,7 +596,6 @@
UITableView *_tableView; UITableView *_tableView;
} }
@property (nonatomic, strong) NSMutableArray *albumArr; @property (nonatomic, strong) NSMutableArray *albumArr;
@property (assign, nonatomic) BOOL isFirstAppear;
@end @end
@implementation TZAlbumPickerController @implementation TZAlbumPickerController
...@@ -621,21 +621,27 @@ ...@@ -621,21 +621,27 @@
if (self.isFirstAppear && !imagePickerVc.navLeftBarButtonSettingBlock) { if (self.isFirstAppear && !imagePickerVc.navLeftBarButtonSettingBlock) {
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSBundle tz_localizedStringForKey:@"Back"] style:UIBarButtonItemStylePlain target:nil action:nil];
self.isFirstAppear = NO;
} }
[self configTableView]; [self configTableView];
} }
- (void)configTableView { - (void)configTableView {
if (self.isFirstAppear) {
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[imagePickerVc showProgressHUD];
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *imagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage completion:^(NSArray<TZAlbumModel *> *models) { [[TZImageManager manager] getAllAlbums:imagePickerVc.allowPickingVideo allowPickingImage:imagePickerVc.allowPickingImage needFetchAssets:!self.isFirstAppear completion:^(NSArray<TZAlbumModel *> *models) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
_albumArr = [NSMutableArray arrayWithArray:models]; _albumArr = [NSMutableArray arrayWithArray:models];
for (TZAlbumModel *albumModel in _albumArr) { for (TZAlbumModel *albumModel in _albumArr) {
albumModel.selectedModels = imagePickerVc.selectedModels; albumModel.selectedModels = imagePickerVc.selectedModels;
} }
[imagePickerVc hideProgressHUD];
self.isFirstAppear = NO;
if (!_tableView) { if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.rowHeight = 70; _tableView.rowHeight = 70;
......
...@@ -73,6 +73,7 @@ static CGFloat itemMargin = 5; ...@@ -73,6 +73,7 @@ static CGFloat itemMargin = 5;
} }
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.isFirstAppear = YES;
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
_isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto; _isSelectOriginalPhoto = tzImagePickerVc.isSelectOriginalPhoto;
_shouldScrollToBottom = YES; _shouldScrollToBottom = YES;
...@@ -93,12 +94,12 @@ static CGFloat itemMargin = 5; ...@@ -93,12 +94,12 @@ static CGFloat itemMargin = 5;
- (void)fetchAssetModels { - (void)fetchAssetModels {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (_isFirstAppear) { if (_isFirstAppear && !_model.models.count) {
[tzImagePickerVc showProgressHUD]; [tzImagePickerVc showProgressHUD];
} }
dispatch_sync(dispatch_get_global_queue(0, 0), ^{ dispatch_async(dispatch_get_global_queue(0, 0), ^{
if (!tzImagePickerVc.sortAscendingByModificationDate && _isFirstAppear && iOS8Later) { if (!tzImagePickerVc.sortAscendingByModificationDate && _isFirstAppear && iOS8Later) {
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:YES completion:^(TZAlbumModel *model) {
_model = model; _model = model;
_models = [NSMutableArray arrayWithArray:_model.models]; _models = [NSMutableArray arrayWithArray:_model.models];
[self initSubviews]; [self initSubviews];
...@@ -562,7 +563,7 @@ static CGFloat itemMargin = 5; ...@@ -562,7 +563,7 @@ static CGFloat itemMargin = 5;
if (iOS7Later) { if (iOS7Later) {
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if (granted) { if (granted) {
dispatch_sync(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self pushImagePickerController]; [self pushImagePickerController];
}); });
} }
...@@ -724,7 +725,7 @@ static CGFloat itemMargin = 5; ...@@ -724,7 +725,7 @@ static CGFloat itemMargin = 5;
- (void)reloadPhotoArray { - (void)reloadPhotoArray {
TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *tzImagePickerVc = (TZImagePickerController *)self.navigationController;
[[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:tzImagePickerVc.allowPickingVideo allowPickingImage:tzImagePickerVc.allowPickingImage needFetchAssets:NO completion:^(TZAlbumModel *model) {
_model = model; _model = model;
[[TZImageManager manager] getAssetsFromFetchResult:_model.result completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:_model.result completion:^(NSArray<TZAssetModel *> *models) {
[tzImagePickerVc hideProgressHUD]; [tzImagePickerVc hideProgressHUD];
......
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
if (iOS7Later) { if (iOS7Later) {
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) { [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
if (granted) { if (granted) {
dispatch_sync(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self takePhoto]; [self takePhoto];
}); });
} }
...@@ -402,7 +402,7 @@ ...@@ -402,7 +402,7 @@
[tzImagePickerVc hideProgressHUD]; [tzImagePickerVc hideProgressHUD];
NSLog(@"图片保存失败 %@",error); NSLog(@"图片保存失败 %@",error);
} else { } else {
[[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES completion:^(TZAlbumModel *model) { [[TZImageManager manager] getCameraRollAlbum:NO allowPickingImage:YES needFetchAssets:NO completion:^(TZAlbumModel *model) {
[[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) { [[TZImageManager manager] getAssetsFromFetchResult:model.result allowPickingVideo:NO allowPickingImage:YES completion:^(NSArray<TZAssetModel *> *models) {
[tzImagePickerVc hideProgressHUD]; [tzImagePickerVc hideProgressHUD];
TZAssetModel *assetModel = [models firstObject]; TZAssetModel *assetModel = [models firstObject];
......
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