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
b6964b93
Commit
b6964b93
authored
Sep 04, 2017
by
Ruslan Balkarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IsCameraRoll to model
parent
e07490f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
10 deletions
+14
-10
TZImagePickerController/TZImagePickerController/TZAssetModel.h
...gePickerController/TZImagePickerController/TZAssetModel.h
+3
-0
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+10
-9
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+1
-1
No files found.
TZImagePickerController/TZImagePickerController/TZAssetModel.h
100644 → 100755
View file @
b6964b93
...
@@ -43,4 +43,7 @@ typedef enum : NSUInteger {
...
@@ -43,4 +43,7 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
strong
)
NSArray
*
models
;
@property
(
nonatomic
,
strong
)
NSArray
*
models
;
@property
(
nonatomic
,
strong
)
NSArray
*
selectedModels
;
@property
(
nonatomic
,
strong
)
NSArray
*
selectedModels
;
@property
(
nonatomic
,
assign
)
NSUInteger
selectedCount
;
@property
(
nonatomic
,
assign
)
NSUInteger
selectedCount
;
@property
(
nonatomic
,
assign
)
BOOL
isCameraRoll
;
@end
@end
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
b6964b93
...
@@ -138,7 +138,7 @@ static dispatch_once_t onceToken;
...
@@ -138,7 +138,7 @@ static dispatch_once_t onceToken;
if
(
!
[
collection
isKindOfClass
:[
PHAssetCollection
class
]])
continue
;
if
(
!
[
collection
isKindOfClass
:[
PHAssetCollection
class
]])
continue
;
if
([
self
isCameraRollAlbum
:
collection
])
{
if
([
self
isCameraRollAlbum
:
collection
])
{
PHFetchResult
*
fetchResult
=
[
PHAsset
fetchAssetsInAssetCollection
:
collection
options
:
option
];
PHFetchResult
*
fetchResult
=
[
PHAsset
fetchAssetsInAssetCollection
:
collection
options
:
option
];
model
=
[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
];
model
=
[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
isCameraRoll
:
YES
];
if
(
completion
)
completion
(
model
);
if
(
completion
)
completion
(
model
);
break
;
break
;
}
}
...
@@ -148,7 +148,7 @@ static dispatch_once_t onceToken;
...
@@ -148,7 +148,7 @@ static dispatch_once_t onceToken;
if
([
group
numberOfAssets
]
<
1
)
return
;
if
([
group
numberOfAssets
]
<
1
)
return
;
if
([
self
isCameraRollAlbum
:
group
])
{
if
([
self
isCameraRollAlbum
:
group
])
{
NSString
*
name
=
[
group
valueForProperty
:
ALAssetsGroupPropertyName
];
NSString
*
name
=
[
group
valueForProperty
:
ALAssetsGroupPropertyName
];
model
=
[
self
modelWithResult
:
group
name
:
name
];
model
=
[
self
modelWithResult
:
group
name
:
name
isCameraRoll
:
YES
];
if
(
completion
)
completion
(
model
);
if
(
completion
)
completion
(
model
);
*
stop
=
YES
;
*
stop
=
YES
;
}
}
...
@@ -190,9 +190,9 @@ static dispatch_once_t onceToken;
...
@@ -190,9 +190,9 @@ static dispatch_once_t onceToken;
if
([
collection
.
localizedTitle
tz_containsString
:
@"Hidden"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"已隐藏"
])
continue
;
if
([
collection
.
localizedTitle
tz_containsString
:
@"Hidden"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"已隐藏"
])
continue
;
if
([
collection
.
localizedTitle
tz_containsString
:
@"Deleted"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"最近删除"
])
continue
;
if
([
collection
.
localizedTitle
tz_containsString
:
@"Deleted"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"最近删除"
])
continue
;
if
([
self
isCameraRollAlbum
:
collection
])
{
if
([
self
isCameraRollAlbum
:
collection
])
{
[
albumArr
insertObject
:[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
]
atIndex
:
0
];
[
albumArr
insertObject
:[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
isCameraRoll
:
YES
]
atIndex
:
0
];
}
else
{
}
else
{
[
albumArr
addObject
:[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
]];
[
albumArr
addObject
:[
self
modelWithResult
:
fetchResult
name
:
collection
.
localizedTitle
isCameraRoll
:
NO
]];
}
}
}
}
}
}
...
@@ -212,15 +212,15 @@ static dispatch_once_t onceToken;
...
@@ -212,15 +212,15 @@ static dispatch_once_t onceToken;
}
}
if
([
self
isCameraRollAlbum
:
group
])
{
if
([
self
isCameraRollAlbum
:
group
])
{
[
albumArr
insertObject
:[
self
modelWithResult
:
group
name
:
name
]
atIndex
:
0
];
[
albumArr
insertObject
:[
self
modelWithResult
:
group
name
:
name
isCameraRoll
:
YES
]
atIndex
:
0
];
}
else
if
([
name
isEqualToString
:
@"My Photo Stream"
]
||
[
name
isEqualToString
:
@"我的照片流"
])
{
}
else
if
([
name
isEqualToString
:
@"My Photo Stream"
]
||
[
name
isEqualToString
:
@"我的照片流"
])
{
if
(
albumArr
.
count
)
{
if
(
albumArr
.
count
)
{
[
albumArr
insertObject
:[
self
modelWithResult
:
group
name
:
name
]
atIndex
:
1
];
[
albumArr
insertObject
:[
self
modelWithResult
:
group
name
:
name
isCameraRoll
:
NO
]
atIndex
:
1
];
}
else
{
}
else
{
[
albumArr
addObject
:[
self
modelWithResult
:
group
name
:
name
]];
[
albumArr
addObject
:[
self
modelWithResult
:
group
name
:
name
isCameraRoll
:
NO
]];
}
}
}
else
{
}
else
{
[
albumArr
addObject
:[
self
modelWithResult
:
group
name
:
name
]];
[
albumArr
addObject
:[
self
modelWithResult
:
group
name
:
name
isCameraRoll
:
NO
]];
}
}
}
failureBlock
:
nil
];
}
failureBlock
:
nil
];
}
}
...
@@ -843,10 +843,11 @@ static dispatch_once_t onceToken;
...
@@ -843,10 +843,11 @@ static dispatch_once_t onceToken;
#pragma mark - Private Method
#pragma mark - Private Method
-
(
TZAlbumModel
*
)
modelWithResult
:(
id
)
result
name
:(
NSString
*
)
name
{
-
(
TZAlbumModel
*
)
modelWithResult
:(
id
)
result
name
:(
NSString
*
)
name
isCameraRoll
:(
BOOL
)
isCameraRoll
{
TZAlbumModel
*
model
=
[[
TZAlbumModel
alloc
]
init
];
TZAlbumModel
*
model
=
[[
TZAlbumModel
alloc
]
init
];
model
.
result
=
result
;
model
.
result
=
result
;
model
.
name
=
name
;
model
.
name
=
name
;
model
.
isCameraRoll
=
isCameraRoll
;
if
([
result
isKindOfClass
:[
PHFetchResult
class
]])
{
if
([
result
isKindOfClass
:[
PHFetchResult
class
]])
{
PHFetchResult
*
fetchResult
=
(
PHFetchResult
*
)
result
;
PHFetchResult
*
fetchResult
=
(
PHFetchResult
*
)
result
;
model
.
count
=
fetchResult
.
count
;
model
.
count
=
fetchResult
.
count
;
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
100644 → 100755
View file @
b6964b93
...
@@ -84,7 +84,7 @@ static CGFloat itemMargin = 5;
...
@@ -84,7 +84,7 @@ static CGFloat itemMargin = 5;
tzImagePickerVc
.
navLeftBarButtonSettingBlock
(
leftButton
);
tzImagePickerVc
.
navLeftBarButtonSettingBlock
(
leftButton
);
self
.
navigationItem
.
leftBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithCustomView
:
leftButton
];
self
.
navigationItem
.
leftBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithCustomView
:
leftButton
];
}
}
_showTakePhotoBtn
=
(
([[
TZImageManager
manager
]
isCameraRollAlbum
:
_model
.
name
])
&&
tzImagePickerVc
.
allowTakePicture
);
_showTakePhotoBtn
=
(
_model
.
isCameraRoll
&&
tzImagePickerVc
.
allowTakePicture
);
// [self resetCachedAssets];
// [self resetCachedAssets];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
didChangeStatusBarOrientationNotification
:
)
name
:
UIApplicationDidChangeStatusBarOrientationNotification
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
didChangeStatusBarOrientationNotification
:
)
name
:
UIApplicationDidChangeStatusBarOrientationNotification
object
:
nil
];
}
}
...
...
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