Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
ab81c6c5
Commit
ab81c6c5
authored
Jul 15, 2020
by
yuzheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增autoSelectCurrentWhenDone属性,可以关闭点完成按钮时自动选中当前图片的特性
parent
febc6b3f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
6 deletions
+10
-6
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+4
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+1
-0
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+1
-1
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+4
-5
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
ab81c6c5
...
@@ -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
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
ab81c6c5
...
@@ -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
;
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
ab81c6c5
...
@@ -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
];
...
...
TZImagePickerController/ViewController.m
View file @
ab81c6c5
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment