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
1b577725
Commit
1b577725
authored
Jun 12, 2016
by
banchichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增allowTakePicture属性,可隐藏拍照按钮
parent
56769d31
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
4 deletions
+12
-4
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+4
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+1
-0
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+5
-3
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+2
-1
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
1b577725
...
...
@@ -56,6 +56,10 @@
/// 默认为YES,如果设置为NO,用户将不能选择发送图片
@property
(
nonatomic
,
assign
)
BOOL
allowPickingImage
;
/// Default is YES.if set NO, user can't take picture.
/// 默认为YES,如果设置为NO,拍照按钮将隐藏,用户将不能在选择器中拍照
@property
(
nonatomic
,
assign
)
BOOL
allowTakePicture
;
/// The photos user have selected
/// 用户选中过的图片数组
@property
(
nonatomic
,
strong
)
NSMutableArray
*
selectedAssets
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
1b577725
...
...
@@ -85,6 +85,7 @@
self
.
allowPickingOriginalPhoto
=
YES
;
self
.
allowPickingVideo
=
YES
;
self
.
allowPickingImage
=
YES
;
self
.
allowTakePicture
=
YES
;
self
.
timeout
=
15
;
self
.
photoWidth
=
828
.
0
;
self
.
photoPreviewMaxWidth
=
540
;
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
1b577725
...
...
@@ -109,7 +109,9 @@ static CGSize AssetGridThumbnailSize;
_collectionView
.
alwaysBounceHorizontal
=
NO
;
if
(
iOS7Later
)
_collectionView
.
contentInset
=
UIEdgeInsetsMake
(
0
,
0
,
0
,
2
);
_collectionView
.
scrollIndicatorInsets
=
UIEdgeInsetsMake
(
0
,
0
,
0
,
-
2
);
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
])
&&
tzImagePickerVc
.
allowTakePicture
)
{
_collectionView
.
contentSize
=
CGSizeMake
(
self
.
view
.
tz_width
,
((
_model
.
count
+
4
)
/
4
)
*
self
.
view
.
tz_width
);
}
else
{
_collectionView
.
contentSize
=
CGSizeMake
(
self
.
view
.
tz_width
,
((
_model
.
count
+
3
)
/
4
)
*
self
.
view
.
tz_width
);
...
...
@@ -287,7 +289,7 @@ static CGSize AssetGridThumbnailSize;
-
(
NSInteger
)
collectionView
:(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:(
NSInteger
)
section
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
tzImagePickerVc
.
allowPickingImage
)
{
if
(
tzImagePickerVc
.
allowPickingImage
&&
tzImagePickerVc
.
allowTakePicture
)
{
return
_models
.
count
+
1
;
}
}
...
...
@@ -442,7 +444,7 @@ static CGSize AssetGridThumbnailSize;
NSInteger
item
=
_models
.
count
-
1
;
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
tzImagePickerVc
.
allowPickingImage
)
{
if
(
tzImagePickerVc
.
allowPickingImage
&&
tzImagePickerVc
.
allowTakePicture
)
{
item
+=
1
;
}
}
...
...
TZImagePickerController/ViewController.m
View file @
1b577725
...
...
@@ -123,6 +123,7 @@
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
9
delegate
:
self
];
imagePickerVc
.
isSelectOriginalPhoto
=
_isSelectOriginalPhoto
;
imagePickerVc
.
selectedAssets
=
_selectedAssets
;
// optional, 可选的
// imagePickerVc.allowTakePicture = NO; // 隐藏拍照按钮
// You can get the photos by block, the same as by delegate.
// 你可以通过block或者代理,来得到用户选择的照片.
...
...
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