diff --git a/PhotoBrowser/ZLPhotoActionSheet.m b/PhotoBrowser/ZLPhotoActionSheet.m index 82d288bd..1e53e2de 100644 --- a/PhotoBrowser/ZLPhotoActionSheet.m +++ b/PhotoBrowser/ZLPhotoActionSheet.m @@ -919,16 +919,26 @@ - (void)saveImage:(UIImage *)image videoUrl:(NSURL *)videoUrl - (void)handleDataArray:(ZLPhotoModel *)model { + zl_weakify(self); + BOOL (^shouldSelect)(void) = ^BOOL() { + zl_strongify(weakSelf); + if (model.type == ZLAssetMediaTypeVideo) { + return (model.asset.duration <= strongSelf.configuration.maxVideoDuration); + } + return YES; + }; + [self.arrDataSources insertObject:model atIndex:0]; if (self.arrDataSources.count > self.configuration.maxPreviewCount) { [self.arrDataSources removeLastObject]; } - if (self.configuration.maxSelectCount > 1 && self.arrSelectedModels.count < self.configuration.maxSelectCount) { - model.selected = YES; + BOOL sel = shouldSelect(); + if (self.configuration.maxSelectCount > 1 && self.arrSelectedModels.count < self.configuration.maxSelectCount && sel) { + model.selected = sel; [self.arrSelectedModels addObject:model]; - } else if (self.configuration.maxSelectCount == 1 && !self.arrSelectedModels.count) { + } else if (self.configuration.maxSelectCount == 1 && !self.arrSelectedModels.count && sel) { if (![self shouldDirectEdit:model]) { - model.selected = YES; + model.selected = sel; [self.arrSelectedModels addObject:model]; [self requestSelPhotos:nil data:self.arrSelectedModels hideAfterCallBack:YES]; return; diff --git a/PhotoBrowser/ZLPhotoBrowser.m b/PhotoBrowser/ZLPhotoBrowser.m index c4281637..52dc54e8 100644 --- a/PhotoBrowser/ZLPhotoBrowser.m +++ b/PhotoBrowser/ZLPhotoBrowser.m @@ -47,6 +47,8 @@ - (void)setConfiguration:(ZLPhotoConfiguration *)configuration [self.navigationBar setBackgroundImage:[self imageWithColor:configuration.navBarColor] forBarMetrics:UIBarMetricsDefault]; [self.navigationBar setTintColor:configuration.navTitleColor]; [self.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: configuration.navTitleColor}]; + [self.navigationBar setBackIndicatorImage:GetImageWithName(@"zl_navBack")]; + [self.navigationBar setBackIndicatorTransitionMaskImage:GetImageWithName(@"zl_navBack")]; } - (UIImage *)imageWithColor:(UIColor *)color diff --git a/PhotoBrowser/ZLShowBigImgViewController.m b/PhotoBrowser/ZLShowBigImgViewController.m index 5cee74a6..92308654 100644 --- a/PhotoBrowser/ZLShowBigImgViewController.m +++ b/PhotoBrowser/ZLShowBigImgViewController.m @@ -189,7 +189,7 @@ - (void)initNavView [self.view addSubview:_navView]; _btnBack = [UIButton buttonWithType:UIButtonTypeCustom]; - [_btnBack setImage:GetImageWithName(@"zl_navBackBtn") forState:UIControlStateNormal]; + [_btnBack setImage:GetImageWithName(@"zl_navBack") forState:UIControlStateNormal]; [_btnBack setImageEdgeInsets:UIEdgeInsetsMake(0, -10, 0, 0)]; [_btnBack addTarget:self action:@selector(btnBack_Click) forControlEvents:UIControlEventTouchUpInside]; [_navView addSubview:_btnBack]; diff --git a/PhotoBrowser/ZLThumbnailViewController.m b/PhotoBrowser/ZLThumbnailViewController.m index ac165a2f..197abb07 100644 --- a/PhotoBrowser/ZLThumbnailViewController.m +++ b/PhotoBrowser/ZLThumbnailViewController.m @@ -916,23 +916,33 @@ - (void)handleDataArray:(ZLPhotoModel *)model ZLImageNavigationController *nav = (ZLImageNavigationController *)self.navigationController; ZLPhotoConfiguration *configuration = nav.configuration; + BOOL (^shouldSelect)(void) = ^BOOL() { + if (model.type == ZLAssetMediaTypeVideo) { + return (model.asset.duration <= configuration.maxVideoDuration); + } + return YES; + }; + if (configuration.sortAscending) { [self.arrDataSources addObject:model]; } else { [self.arrDataSources insertObject:model atIndex:0]; } - if (configuration.maxSelectCount > 1 && nav.arrSelectedModels.count < configuration.maxSelectCount) { - model.selected = YES; + + BOOL sel = shouldSelect(); + if (configuration.maxSelectCount > 1 && nav.arrSelectedModels.count < configuration.maxSelectCount && sel) { + model.selected = sel; [nav.arrSelectedModels addObject:model]; - self.albumListModel = [ZLPhotoManager getCameraRollAlbumList:configuration.allowSelectVideo allowSelectImage:configuration.allowSelectImage]; - } else if (configuration.maxSelectCount == 1 && !nav.arrSelectedModels.count) { + } else if (configuration.maxSelectCount == 1 && !nav.arrSelectedModels.count && sel) { if (![self shouldDirectEdit:model]) { - model.selected = YES; + model.selected = sel; [nav.arrSelectedModels addObject:model]; [self btnDone_Click:nil]; return; } } + + self.albumListModel = [ZLPhotoManager getCameraRollAlbumList:configuration.allowSelectVideo allowSelectImage:configuration.allowSelectImage]; [self.collectionView reloadData]; [self scrollToBottom]; [self resetBottomBtnsStatus:YES]; diff --git a/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@2x.png b/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@2x.png new file mode 100644 index 00000000..a7f2e91a Binary files /dev/null and b/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@2x.png differ diff --git a/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@3x.png b/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@3x.png new file mode 100644 index 00000000..b8a6760b Binary files /dev/null and b/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBack@3x.png differ diff --git a/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBackBtn@2x.png b/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBackBtn@2x.png deleted file mode 100755 index 633b9e6d..00000000 Binary files a/PhotoBrowser/resource/ZLPhotoBrowser.bundle/zl_navBackBtn@2x.png and /dev/null differ diff --git a/ZLPhotoBrowser/ViewController.m b/ZLPhotoBrowser/ViewController.m index e345e846..09a0e39c 100644 --- a/ZLPhotoBrowser/ViewController.m +++ b/ZLPhotoBrowser/ViewController.m @@ -142,13 +142,15 @@ - (ZLPhotoActionSheet *)getPas actionSheet.configuration.languageType = self.languageSegment.selectedSegmentIndex; //自定义多语言 // actionSheet.configuration.customLanguageKeyValue = @{@"ZLPhotoBrowserCameraText": @"没错,我就是一个相机"}; + //自定义图片 +// actionSheet.configuration.customImageNames = @[@"zl_navBack"]; //是否使用系统相机 // actionSheet.configuration.useSystemCamera = YES; // actionSheet.configuration.sessionPreset = ZLCaptureSessionPreset1920x1080; // actionSheet.configuration.exportVideoType = ZLExportVideoTypeMp4; // actionSheet.configuration.allowRecordVideo = NO; - +// actionSheet.configuration.maxVideoDuration = 5; #pragma mark - required //如果调用的方法没有传sender,则该属性必须提前赋值 actionSheet.sender = self;