From e50781c95a091b445d7c527beb141d494a2a70d1 Mon Sep 17 00:00:00 2001 From: longitachi Date: Fri, 29 Sep 2017 16:59:25 +0800 Subject: [PATCH] fix #101, #102 --- PhotoBrowser/ZLPhotoActionSheet.h | 3 ++- PhotoBrowser/ZLPhotoActionSheet.m | 3 ++- PhotoBrowser/ZLThumbnailViewController.m | 4 +++- ZLPhotoBrowser.podspec | 2 +- ZLPhotoBrowser/ViewController.m | 4 +++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/PhotoBrowser/ZLPhotoActionSheet.h b/PhotoBrowser/ZLPhotoActionSheet.h index c3cf7cef..54a986b6 100644 --- a/PhotoBrowser/ZLPhotoActionSheet.h +++ b/PhotoBrowser/ZLPhotoActionSheet.h @@ -194,8 +194,9 @@ NS_ASSUME_NONNULL_BEGIN @param photos 已选择的uiimage照片数组 @param assets 已选择的phasset照片数组 @param index 点击的照片索引 + @param isOriginal 是否为原图 */ -- (void)previewSelectedPhotos:(NSArray *)photos assets:(NSArray *)assets index:(NSInteger)index; +- (void)previewSelectedPhotos:(NSArray *)photos assets:(NSArray *)assets index:(NSInteger)index isOriginal:(BOOL)isOriginal; /** diff --git a/PhotoBrowser/ZLPhotoActionSheet.m b/PhotoBrowser/ZLPhotoActionSheet.m index 3dcd2a91..5118ae5a 100644 --- a/PhotoBrowser/ZLPhotoActionSheet.m +++ b/PhotoBrowser/ZLPhotoActionSheet.m @@ -249,8 +249,9 @@ - (void)showPreview:(BOOL)preview animate:(BOOL)animate } } -- (void)previewSelectedPhotos:(NSArray *)photos assets:(NSArray *)assets index:(NSInteger)index +- (void)previewSelectedPhotos:(NSArray *)photos assets:(NSArray *)assets index:(NSInteger)index isOriginal:(BOOL)isOriginal { + self.isSelectOriginalPhoto = isOriginal; self.arrSelectedAssets = [NSMutableArray arrayWithArray:assets]; ZLShowBigImgViewController *svc = [self pushBigImageToPreview:photos index:index]; weakify(self); diff --git a/PhotoBrowser/ZLThumbnailViewController.m b/PhotoBrowser/ZLThumbnailViewController.m index 43aca85e..300f8400 100644 --- a/PhotoBrowser/ZLThumbnailViewController.m +++ b/PhotoBrowser/ZLThumbnailViewController.m @@ -83,7 +83,9 @@ - (void)dealloc strongSelf.arrDataSources = [NSMutableArray arrayWithArray:strongSelf.albumListModel.models]; [hud hide]; dispatch_async(dispatch_get_main_queue(), ^{ - strongSelf.allowTakePhoto = YES; + if (weakNav.allowTakePhotoInLibrary && weakNav.allowSelectImage) { + strongSelf.allowTakePhoto = YES; + } [strongSelf.collectionView reloadData]; [strongSelf scrollToBottom]; }); diff --git a/ZLPhotoBrowser.podspec b/ZLPhotoBrowser.podspec index bde35e31..e6e001a2 100644 --- a/ZLPhotoBrowser.podspec +++ b/ZLPhotoBrowser.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'ZLPhotoBrowser' - s.version = '2.4.4' + s.version = '2.4.5' s.summary = 'A simple way to multiselect photos,video,gif,livephoto from ablum,force touch to preview image,support portrait and landscape,multiple languages(Chinese,English,Japanese)' s.homepage = 'https://github.com/longitachi/ZLPhotoBrowser' s.license = 'MIT' diff --git a/ZLPhotoBrowser/ViewController.m b/ZLPhotoBrowser/ViewController.m index f89df0fd..60fab2bf 100644 --- a/ZLPhotoBrowser/ViewController.m +++ b/ZLPhotoBrowser/ViewController.m @@ -46,6 +46,7 @@ @interface ViewController () @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; @property (nonatomic, strong) NSArray *arrDataSources; +@property (nonatomic, assign) BOOL isOriginal; @end @@ -126,6 +127,7 @@ - (ZLPhotoActionSheet *)getPas [actionSheet setSelectImageBlock:^(NSArray * _Nonnull images, NSArray * _Nonnull assets, BOOL isOriginal) { strongify(weakSelf); strongSelf.arrDataSources = images; + strongSelf.isOriginal = isOriginal; strongSelf.lastSelectAssets = assets.mutableCopy; strongSelf.lastSelectPhotos = images.mutableCopy; [strongSelf.collectionView reloadData]; @@ -173,7 +175,7 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - [[self getPas] previewSelectedPhotos:self.lastSelectPhotos assets:self.lastSelectAssets index:indexPath.row]; + [[self getPas] previewSelectedPhotos:self.lastSelectPhotos assets:self.lastSelectAssets index:indexPath.row isOriginal:self.isOriginal]; } - (IBAction)btnPreviewNetImageClick:(id)sender