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
514b8aae
Commit
514b8aae
authored
May 07, 2018
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增showPhotoCannotSelectLayer属性,当已选照片张数达到最大可选张数时,可像微信一样让其它照片显示一个浮层
parent
66f70eb1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
5 deletions
+39
-5
TZImagePickerController/TZImagePickerController/TZAssetCell.h
...agePickerController/TZImagePickerController/TZAssetCell.h
+1
-0
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+16
-3
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+6
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+1
-0
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+12
-1
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+3
-1
No files found.
TZImagePickerController/TZImagePickerController/TZAssetCell.h
View file @
514b8aae
...
...
@@ -21,6 +21,7 @@ typedef enum : NSUInteger {
@interface
TZAssetCell
:
UICollectionViewCell
@property
(
weak
,
nonatomic
)
UIButton
*
selectPhotoButton
;
@property
(
weak
,
nonatomic
)
UIButton
*
cannotSelectLayerButton
;
@property
(
nonatomic
,
strong
)
TZAssetModel
*
model
;
@property
(
assign
,
nonatomic
)
NSInteger
index
;
@property
(
nonatomic
,
copy
)
void
(
^
didSelectPhotoBlock
)(
BOOL
);
...
...
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
514b8aae
...
...
@@ -190,9 +190,6 @@
imageView
.
clipsToBounds
=
YES
;
[
self
.
contentView
addSubview
:
imageView
];
_imageView
=
imageView
;
[
self
.
contentView
bringSubviewToFront
:
_selectImageView
];
[
self
.
contentView
bringSubviewToFront
:
_bottomView
];
}
return
_imageView
;
}
...
...
@@ -219,6 +216,15 @@
return
_bottomView
;
}
-
(
UIButton
*
)
cannotSelectLayerButton
{
if
(
_cannotSelectLayerButton
==
nil
)
{
UIButton
*
cannotSelectLayerButton
=
[[
UIButton
alloc
]
init
];
[
self
.
contentView
addSubview
:
cannotSelectLayerButton
];
_cannotSelectLayerButton
=
cannotSelectLayerButton
;
}
return
_cannotSelectLayerButton
;
}
-
(
UIImageView
*
)
videoImgView
{
if
(
_videoImgView
==
nil
)
{
UIImageView
*
videoImgView
=
[[
UIImageView
alloc
]
init
];
...
...
@@ -264,6 +270,7 @@
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
_cannotSelectLayerButton
.
frame
=
self
.
bounds
;
if
(
self
.
allowPreview
)
{
_selectPhotoButton
.
frame
=
CGRectMake
(
self
.
tz_width
-
44
,
0
,
44
,
44
);
}
else
{
...
...
@@ -288,6 +295,12 @@
self
.
type
=
(
NSInteger
)
self
.
model
.
type
;
self
.
showSelectBtn
=
self
.
showSelectBtn
;
[
self
.
contentView
bringSubviewToFront
:
_bottomView
];
[
self
.
contentView
bringSubviewToFront
:
_cannotSelectLayerButton
];
[
self
.
contentView
bringSubviewToFront
:
_selectPhotoButton
];
[
self
.
contentView
bringSubviewToFront
:
_selectImageView
];
[
self
.
contentView
bringSubviewToFront
:
_indexLabel
];
}
@end
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
514b8aae
...
...
@@ -122,6 +122,12 @@
/// 默认为NO,如果设置为YES,会显示照片的选中序号
@property
(
assign
,
nonatomic
)
BOOL
showSelectedIndex
;
/// Default is NO, if set YES, when selected photos's count up to maxImagesCount, other photo will show float layer what's color is cannotSelectLayerColor.
/// 默认是NO,如果设置为YES,当照片选择张数达到maxImagesCount时,其它照片会显示颜色为cannotSelectLayerColor的浮层
@property
(
assign
,
nonatomic
)
BOOL
showPhotoCannotSelectLayer
;
/// Default is white color with 0.8 alpha;
@property
(
strong
,
nonatomic
)
UIColor
*
cannotSelectLayerColor
;
/// The photos user have selected
/// 用户选中过的图片数组
@property
(
nonatomic
,
strong
)
NSMutableArray
*
selectedAssets
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
514b8aae
...
...
@@ -277,6 +277,7 @@
self
.
barItemTextColor
=
[
UIColor
whiteColor
];
self
.
allowPreview
=
YES
;
self
.
statusBarStyle
=
UIStatusBarStyleLightContent
;
self
.
cannotSelectLayerColor
=
[[
UIColor
whiteColor
]
colorWithAlphaComponent
:
0
.
8
];
self
.
iconThemeColor
=
[
UIColor
colorWithRed
:
31
/
255
.
0
green
:
185
/
255
.
0
blue
:
34
/
255
.
0
alpha
:
1
.
0
];
[
self
configDefaultBtnTitle
];
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
514b8aae
...
...
@@ -492,6 +492,13 @@ static CGFloat itemMargin = 5;
cell
.
showSelectBtn
=
tzImagePickerVc
.
showSelectBtn
;
cell
.
allowPreview
=
tzImagePickerVc
.
allowPreview
;
if
(
tzImagePickerVc
.
selectedModels
.
count
>=
tzImagePickerVc
.
maxImagesCount
&&
tzImagePickerVc
.
showPhotoCannotSelectLayer
&&
!
model
.
isSelected
)
{
cell
.
cannotSelectLayerButton
.
backgroundColor
=
tzImagePickerVc
.
cannotSelectLayerColor
;
cell
.
cannotSelectLayerButton
.
hidden
=
NO
;
}
else
{
cell
.
cannotSelectLayerButton
.
hidden
=
YES
;
}
__weak
typeof
(
cell
)
weakCell
=
cell
;
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
_numberImageView
.
layer
)
weakLayer
=
_numberImageView
.
layer
;
...
...
@@ -515,6 +522,7 @@ static CGFloat itemMargin = 5;
if
(
tzImagePickerVc
.
showSelectedIndex
)
{
[
strongSelf
setUseCachedImageAndReloadData
];
}
[
UIView
showOscillatoryAnimationWithLayer
:
strongLayer
type
:
TZOscillatoryAnimationToSmaller
];
}
else
{
// 2. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
if
(
tzImagePickerVc
.
selectedModels
.
count
<
tzImagePickerVc
.
maxImagesCount
)
{
...
...
@@ -526,12 +534,15 @@ static CGFloat itemMargin = 5;
}
[
tzImagePickerVc
addSelectedModel
:
model
];
[
strongSelf
refreshBottomToolBarStatus
];
[
UIView
showOscillatoryAnimationWithLayer
:
strongLayer
type
:
TZOscillatoryAnimationToSmaller
];
}
else
{
NSString
*
title
=
[
NSString
stringWithFormat
:[
NSBundle
tz_localizedStringForKey
:
@"Select a maximum of %zd photos"
],
tzImagePickerVc
.
maxImagesCount
];
[
tzImagePickerVc
showAlertWithTitle
:
title
];
}
}
[
UIView
showOscillatoryAnimationWithLayer
:
strongLayer
type
:
TZOscillatoryAnimationToSmaller
];
if
(
tzImagePickerVc
.
showPhotoCannotSelectLayer
&&
!
tzImagePickerVc
.
showSelectedIndex
)
{
[
strongSelf
.
collectionView
reloadData
];
}
};
return
cell
;
}
...
...
TZImagePickerController/ViewController.m
View file @
514b8aae
...
...
@@ -250,7 +250,9 @@
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
// imagePickerVc.navigationBar.translucent = NO;
imagePickerVc
.
iconThemeColor
=
[
UIColor
redColor
];
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
];
// 3. Set allow picking video & photo & originalPhoto or not
// 3. 设置是否可以选择视频/图片/原图
...
...
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