Commit ab81c6c5 authored by yuzheng's avatar yuzheng

新增autoSelectCurrentWhenDone属性,可以关闭点完成按钮时自动选中当前图片的特性

parent febc6b3f
...@@ -48,6 +48,10 @@ ...@@ -48,6 +48,10 @@
/// 最小照片必选张数,默认是0 /// 最小照片必选张数,默认是0
@property (nonatomic, assign) NSInteger minImagesCount; @property (nonatomic, assign) NSInteger minImagesCount;
/// If the user does not select any pictures, the current picture is automatically selected when the Finish button is clicked, Default is YES
/// 如果用户未选择任何图片,在点击完成按钮时自动选中当前图片,默认YES
@property (nonatomic, assign) BOOL autoSelectCurrentWhenDone;
/// Always enale the done button, not require minimum 1 photo be picked /// Always enale the done button, not require minimum 1 photo be picked
/// 让完成按钮一直可以点击,无须最少选择一张图片 /// 让完成按钮一直可以点击,无须最少选择一张图片
@property (nonatomic, assign) BOOL alwaysEnableDoneBtn; @property (nonatomic, assign) BOOL alwaysEnableDoneBtn;
......
...@@ -263,6 +263,7 @@ ...@@ -263,6 +263,7 @@
} }
- (void)configDefaultSetting { - (void)configDefaultSetting {
self.autoSelectCurrentWhenDone = YES;
self.timeout = 15; self.timeout = 15;
self.photoWidth = 828.0; self.photoWidth = 828.0;
self.photoPreviewMaxWidth = 600; self.photoPreviewMaxWidth = 600;
......
...@@ -383,7 +383,7 @@ ...@@ -383,7 +383,7 @@
} }
// 如果没有选中过照片 点击确定时选中当前预览的照片 // 如果没有选中过照片 点击确定时选中当前预览的照片
if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0) { if (_tzImagePickerVc.selectedModels.count == 0 && _tzImagePickerVc.minImagesCount <= 0 && _tzImagePickerVc.autoSelectCurrentWhenDone) {
[self select:_selectButton]; [self select:_selectButton];
} }
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0];
......
...@@ -213,6 +213,7 @@ ...@@ -213,6 +213,7 @@
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.item]; TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.item];
imagePickerVc.maxImagesCount = self.maxCountTF.text.integerValue; imagePickerVc.maxImagesCount = self.maxCountTF.text.integerValue;
imagePickerVc.allowPickingGif = self.allowPickingGifSwitch.isOn; imagePickerVc.allowPickingGif = self.allowPickingGifSwitch.isOn;
imagePickerVc.autoSelectCurrentWhenDone = NO;
imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn; imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn;
imagePickerVc.allowPickingMultipleVideo = self.allowPickingMuitlpleVideoSwitch.isOn; imagePickerVc.allowPickingMultipleVideo = self.allowPickingMuitlpleVideoSwitch.isOn;
imagePickerVc.showSelectedIndex = self.showSelectedIndexSwitch.isOn; imagePickerVc.showSelectedIndex = self.showSelectedIndexSwitch.isOn;
...@@ -279,6 +280,7 @@ ...@@ -279,6 +280,7 @@
[imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) { [imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) {
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh; imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
}]; }];
imagePickerVc.autoSelectCurrentWhenDone = NO;
// imagePickerVc.photoWidth = 1600; // imagePickerVc.photoWidth = 1600;
// imagePickerVc.photoPreviewMaxWidth = 1600; // imagePickerVc.photoPreviewMaxWidth = 1600;
...@@ -292,9 +294,11 @@ ...@@ -292,9 +294,11 @@
imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0]; imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];
imagePickerVc.showPhotoCannotSelectLayer = YES; imagePickerVc.showPhotoCannotSelectLayer = YES;
imagePickerVc.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8]; imagePickerVc.cannotSelectLayerColor = [[UIColor whiteColor] colorWithAlphaComponent:0.8];
/*
[imagePickerVc setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) { [imagePickerVc setPhotoPickerPageUIConfigBlock:^(UICollectionView *collectionView, UIView *bottomToolBar, UIButton *previewButton, UIButton *originalPhotoButton, UILabel *originalPhotoLabel, UIButton *doneButton, UIImageView *numberImageView, UILabel *numberLabel, UIView *divideLine) {
[doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; [doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}]; }];
*/
/* /*
[imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) { [imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
cell.contentView.clipsToBounds = YES; cell.contentView.clipsToBounds = YES;
...@@ -527,11 +531,6 @@ ...@@ -527,11 +531,6 @@
[_selectedAssets addObject:asset]; [_selectedAssets addObject:asset];
[_selectedPhotos addObject:image]; [_selectedPhotos addObject:image];
[_collectionView reloadData]; [_collectionView reloadData];
if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = asset;
NSLog(@"location:%@",phAsset.location);
}
} }
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
......
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