Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加一个微信对预览界面done按钮的细节处理 #899

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ - (void)navLeftBarButtonClick{
}
- (void)previewButtonClick {
TZPhotoPreviewController *photoPreviewVc = [[TZPhotoPreviewController alloc] init];
photoPreviewVc.enableDoneWhenNoneSelect = NO;
[self pushPhotoPrevireViewController:photoPreviewVc needCheckSelectedModels:YES];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
@property (nonatomic, assign) NSInteger currentIndex; ///< Index of the photo user click / 用户点击的图片的索引
@property (nonatomic, assign) BOOL isSelectOriginalPhoto; ///< If YES,return original photo / 是否返回原图
@property (nonatomic, assign) BOOL isCropImage;
@property (nonatomic, assign) BOOL enableDoneWhenNoneSelect; ///< default is YES. If YES,return When no photos are selected, can you click the done button / 没有选择任何照片时,是否可以点击done按钮

/// Return the new selected photos / 返回最新的选中图片数组
@property (nonatomic, copy) void (^backButtonClickBlock)(BOOL isSelectOriginalPhoto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ @interface TZPhotoPreviewController ()<UICollectionViewDataSource,UICollectionVi

@implementation TZPhotoPreviewController

- (instancetype)init
{
self = [super init];
if (self) {
_enableDoneWhenNoneSelect = YES;
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];
[TZImageManager manager].shouldFixOrientation = YES;
Expand Down Expand Up @@ -336,6 +345,7 @@ - (void)select:(UIButton *)selectButton {
}
model.isSelected = !selectButton.isSelected;
[self refreshNaviBarAndBottomBarState];
[self checkDoneButtonEnable];
if (model.isSelected) {
[UIView showOscillatoryAnimationWithLayer:selectButton.imageView.layer type:TZOscillatoryAnimationToBigger];
}
Expand Down Expand Up @@ -492,6 +502,19 @@ - (void)dealloc {
// NSLog(@"%@ dealloc",NSStringFromClass(self.class));
}

- (void)checkDoneButtonEnable {
if (!_enableDoneWhenNoneSelect) {
// When no photos are selected, can't click the done button
// 没有选择任何照片时,不可以点击done按钮
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0) {
_doneButton.enabled = NO;
} else {
_doneButton.enabled = YES;
}
}
}

- (void)refreshNaviBarAndBottomBarState {
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
TZAssetModel *model = _models[_currentIndex];
Expand Down