Skip to content

Commit a15900e

Browse files
committed
修复allowPreview为No时,GIF可以被重复选中的问题
1 parent ab81c6c commit a15900e

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,17 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cell
574574
} else {
575575
// 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
576576
if (tzImagePickerVc.selectedModels.count < tzImagePickerVc.maxImagesCount) {
577-
if (tzImagePickerVc.maxImagesCount == 1 && !tzImagePickerVc.allowPreview) {
578-
model.isSelected = YES;
579-
[tzImagePickerVc addSelectedModel:model];
580-
[strongSelf doneButtonClick];
581-
return;
577+
if (!tzImagePickerVc.allowPreview) {
578+
BOOL shouldDone = tzImagePickerVc.maxImagesCount == 1;
579+
if (!tzImagePickerVc.allowPickingMultipleVideo && (model.type == TZAssetModelMediaTypeVideo || model.type == TZAssetModelMediaTypePhotoGif)) {
580+
shouldDone = YES;
581+
}
582+
if (shouldDone) {
583+
model.isSelected = YES;
584+
[tzImagePickerVc addSelectedModel:model];
585+
[strongSelf doneButtonClick];
586+
return;
587+
}
582588
}
583589
strongCell.selectPhotoButton.selected = YES;
584590
model.isSelected = YES;

TZImagePickerController/ViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ - (void)pushTZImagePickerController {
342342
cropView.layer.borderWidth = 2.0;
343343
}];*/
344344

345-
//imagePickerVc.allowPreview = NO;
345+
// imagePickerVc.allowPreview = NO;
346346
// 自定义导航栏上的返回按钮
347347
/*
348348
[imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){

0 commit comments

Comments
 (0)