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
c9c9e3d3
Commit
c9c9e3d3
authored
May 03, 2016
by
banchichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增对所有照片相册的适配
parent
95dfbaed
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
6 deletions
+19
-6
TZImagePickerController/LxGridViewFlowLayout.h
TZImagePickerController/LxGridViewFlowLayout.h
+6
-0
TZImagePickerController/LxGridViewFlowLayout.m
TZImagePickerController/LxGridViewFlowLayout.m
+7
-0
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+2
-2
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+4
-4
No files found.
TZImagePickerController/LxGridViewFlowLayout.h
View file @
c9c9e3d3
...
...
@@ -5,6 +5,12 @@
#import <UIKit/UIKit.h>
/*
此类来源于DeveloperLx的优秀开源项目:LxGridView
github链接:https://github.com/DeveloperLx/LxGridView
我对这个类的代码做了一些修改;
感谢DeveloperLx的优秀代码~
*/
@interface
LxGridViewFlowLayout
:
UICollectionViewFlowLayout
...
...
TZImagePickerController/LxGridViewFlowLayout.m
View file @
c9c9e3d3
...
...
@@ -17,6 +17,13 @@ CG_INLINE CGPoint CGPointOffset(CGPoint point, CGFloat dx, CGFloat dy)
return
CGPointMake
(
point
.
x
+
dx
,
point
.
y
+
dy
);
}
/*
此类来源于DeveloperLx的优秀开源项目:LxGridView
github链接:https://github.com/DeveloperLx/LxGridView
我对这个类的代码做了一些修改;
感谢DeveloperLx的优秀代码~
*/
@interface
LxGridViewFlowLayout
()
<
UIGestureRecognizerDelegate
>
@property
(
nonatomic
,
readonly
)
id
<
LxGridViewDataSource
>
dataSource
;
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
c9c9e3d3
...
...
@@ -56,7 +56,7 @@
PHFetchResult
*
smartAlbums
=
[
PHAssetCollection
fetchAssetCollectionsWithType
:
PHAssetCollectionTypeSmartAlbum
subtype
:
PHAssetCollectionSubtypeSmartAlbumUserLibrary
options
:
nil
];
for
(
PHAssetCollection
*
collection
in
smartAlbums
)
{
if
([
collection
.
localizedTitle
isEqualToString
:
@"Camera Roll"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"相机胶卷"
])
{
if
([
collection
.
localizedTitle
isEqualToString
:
@"Camera Roll"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"相机胶卷"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"所有照片"
]
)
{
PHFetchResult
*
fetchResult
=
[
PHAsset
fetchAssetsInAssetCollection
:
collection
options
:
option
];
model
=
[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
];
if
(
completion
)
completion
(
model
);
...
...
@@ -68,7 +68,7 @@
if
([
group
numberOfAssets
]
<
1
)
return
;
NSString
*
name
=
[
group
valueForProperty
:
ALAssetsGroupPropertyName
];
if
([
name
isEqualToString
:
@"Camera Roll"
]
||
[
name
isEqualToString
:
@"相机胶卷"
])
{
if
([
name
isEqualToString
:
@"Camera Roll"
]
||
[
name
isEqualToString
:
@"相机胶卷"
]
||
[
name
isEqualToString
:
@"所有照片"
]
)
{
model
=
[
self
modelWithResult
:
group
name
:
name
];
if
(
completion
)
completion
(
model
);
*
stop
=
YES
;
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
c9c9e3d3
...
...
@@ -69,7 +69,7 @@ static CGSize AssetGridThumbnailSize;
self
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
navigationItem
.
title
=
_model
.
name
;
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"取消"
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
cancel
)];
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
])
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
[[
TZImageManager
manager
]
getAssetsFromFetchResult
:
_model
.
result
allowPickingVideo
:
_tzImagePickerVc
.
allowPickingVideo
allowPickingImage
:
_tzImagePickerVc
.
allowPickingImage
completion
:^
(
NSArray
<
TZAssetModel
*>
*
models
)
{
_photoArr
=
[
NSMutableArray
arrayWithArray
:
models
];
[
self
initSubviews
];
...
...
@@ -111,7 +111,7 @@ 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"
]
)
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
_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
);
...
...
@@ -283,7 +283,7 @@ static CGSize AssetGridThumbnailSize;
#pragma mark - UICollectionViewDataSource && Delegate
-
(
NSInteger
)
collectionView
:(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:(
NSInteger
)
section
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
])
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
if
(
_tzImagePickerVc
.
allowPickingImage
)
{
return
_photoArr
.
count
+
1
;
}
...
...
@@ -431,7 +431,7 @@ static CGSize AssetGridThumbnailSize;
-
(
void
)
scrollCollectionViewToBottom
{
if
(
_shouldScrollToBottom
&&
_photoArr
.
count
>
0
)
{
NSInteger
item
=
_photoArr
.
count
-
1
;
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
])
{
if
([
_model
.
name
isEqualToString
:
@"相机胶卷"
]
||
[
_model
.
name
isEqualToString
:
@"Camera Roll"
]
||
[
_model
.
name
isEqualToString
:
@"所有照片"
]
)
{
if
(
_tzImagePickerVc
.
allowPickingImage
)
{
item
+=
1
;
}
...
...
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