Commit ab81c6c5 authored by yuzheng's avatar yuzheng

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

parent febc6b3f
......@@ -48,6 +48,10 @@
/// 最小照片必选张数,默认是0
@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
/// 让完成按钮一直可以点击,无须最少选择一张图片
@property (nonatomic, assign) BOOL alwaysEnableDoneBtn;
......
......@@ -263,6 +263,7 @@
}
- (void)configDefaultSetting {
self.autoSelectCurrentWhenDone = YES;
self.timeout = 15;
self.photoWidth = 828.0;
self.photoPreviewMaxWidth = 600;
......
......@@ -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];
}
NSIndexPath *indexPath = [NSIndexPath indexPathForItem:self.currentIndex inSection:0];
......
......@@ -213,6 +213,7 @@
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithSelectedAssets:_selectedAssets selectedPhotos:_selectedPhotos index:indexPath.item];
imagePickerVc.maxImagesCount = self.maxCountTF.text.integerValue;
imagePickerVc.allowPickingGif = self.allowPickingGifSwitch.isOn;
imagePickerVc.autoSelectCurrentWhenDone = NO;
imagePickerVc.allowPickingOriginalPhoto = self.allowPickingOriginalPhotoSwitch.isOn;
imagePickerVc.allowPickingMultipleVideo = self.allowPickingMuitlpleVideoSwitch.isOn;
imagePickerVc.showSelectedIndex = self.showSelectedIndexSwitch.isOn;
......@@ -279,6 +280,7 @@
[imagePickerVc setUiImagePickerControllerSettingBlock:^(UIImagePickerController *imagePickerController) {
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
}];
imagePickerVc.autoSelectCurrentWhenDone = NO;
// imagePickerVc.photoWidth = 1600;
// imagePickerVc.photoPreviewMaxWidth = 1600;
......@@ -292,9 +294,11 @@
imagePickerVc.iconThemeColor = [UIColor colorWithRed:31 / 255.0 green:185 / 255.0 blue:34 / 255.0 alpha:1.0];
imagePickerVc.showPhotoCannotSelectLayer = YES;
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) {
[doneButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}];
*/
/*
[imagePickerVc setAssetCellDidSetModelBlock:^(TZAssetCell *cell, UIImageView *imageView, UIImageView *selectImageView, UILabel *indexLabel, UIView *bottomView, UILabel *timeLength, UIImageView *videoImgView) {
cell.contentView.clipsToBounds = YES;
......@@ -527,11 +531,6 @@
[_selectedAssets addObject:asset];
[_selectedPhotos addObject:image];
[_collectionView reloadData];
if ([asset isKindOfClass:[PHAsset class]]) {
PHAsset *phAsset = asset;
NSLog(@"location:%@",phAsset.location);
}
}
- (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