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
9e8f7ec8
Commit
9e8f7ec8
authored
Aug 23, 2018
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除iOS6和7的适配代码
parent
c8c2fe3f
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
474 additions
and
983 deletions
+474
-983
TZImagePickerController.podspec
TZImagePickerController.podspec
+1
-1
TZImagePickerController.xcodeproj/project.pbxproj
TZImagePickerController.xcodeproj/project.pbxproj
+0
-2
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+4
-12
TZImagePickerController/TZImagePickerController/TZAssetModel.h
...gePickerController/TZImagePickerController/TZAssetModel.h
+7
-7
TZImagePickerController/TZImagePickerController/TZAssetModel.m
...gePickerController/TZImagePickerController/TZAssetModel.m
+4
-4
TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m
...ler/TZImagePickerController/TZGifPhotoPreviewController.m
+5
-7
TZImagePickerController/TZImagePickerController/TZImageManager.h
...PickerController/TZImagePickerController/TZImageManager.h
+21
-26
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+308
-636
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+8
-21
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+31
-93
TZImagePickerController/TZImagePickerController/TZLocationManager.m
...kerController/TZImagePickerController/TZLocationManager.m
+1
-3
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+26
-46
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
...erController/TZImagePickerController/TZPhotoPreviewCell.m
+2
-2
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+6
-7
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
...troller/TZImagePickerController/TZVideoPlayerController.m
+3
-3
TZImagePickerController/TZTestCell.m
TZImagePickerController/TZTestCell.m
+4
-12
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+43
-101
No files found.
TZImagePickerController.podspec
View file @
9e8f7ec8
...
@@ -11,5 +11,5 @@ Pod::Spec.new do |s|
...
@@ -11,5 +11,5 @@ Pod::Spec.new do |s|
s
.
requires_arc
=
true
s
.
requires_arc
=
true
s
.
resources
=
"TZImagePickerController/TZImagePickerController/*.{png,bundle}"
s
.
resources
=
"TZImagePickerController/TZImagePickerController/*.{png,bundle}"
s
.
source_files
=
"TZImagePickerController/TZImagePickerController/*.{h,m}"
s
.
source_files
=
"TZImagePickerController/TZImagePickerController/*.{h,m}"
s
.
frameworks
=
"Photos"
,
"AssetsLibrary"
s
.
frameworks
=
"Photos"
end
end
TZImagePickerController.xcodeproj/project.pbxproj
View file @
9e8f7ec8
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
902938D81EE2D02C000F2F8F
/* TZLocationManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
902938D71EE2D02C000F2F8F
/* TZLocationManager.m */
;
};
902938D81EE2D02C000F2F8F
/* TZLocationManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
902938D71EE2D02C000F2F8F
/* TZLocationManager.m */
;
};
9038D5911C3974F0007DE549
/* TZTestCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9038D5901C3974F0007DE549
/* TZTestCell.m */
;
};
9038D5911C3974F0007DE549
/* TZTestCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9038D5901C3974F0007DE549
/* TZTestCell.m */
;
};
903996931F447604005E77C2
/* Photos.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
903996921F447604005E77C2
/* Photos.framework */
;
};
903996931F447604005E77C2
/* Photos.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
903996921F447604005E77C2
/* Photos.framework */
;
};
903996951F447609005E77C2
/* AssetsLibrary.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
903996941F447609005E77C2
/* AssetsLibrary.framework */
;
};
90A74B85203287C200D84C2A
/* Localizable.strings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90A74B83203287C200D84C2A
/* Localizable.strings */
;
};
90A74B85203287C200D84C2A
/* Localizable.strings in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90A74B83203287C200D84C2A
/* Localizable.strings */
;
};
90CE84AE1C3A89EF003D0779
/* TZImageManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90CE84AD1C3A89EF003D0779
/* TZImageManager.m */
;
};
90CE84AE1C3A89EF003D0779
/* TZImageManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90CE84AD1C3A89EF003D0779
/* TZImageManager.m */
;
};
90CE84B71C3BABB6003D0779
/* TZVideoPlayerController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90CE84B61C3BABB6003D0779
/* TZVideoPlayerController.m */
;
};
90CE84B71C3BABB6003D0779
/* TZVideoPlayerController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90CE84B61C3BABB6003D0779
/* TZVideoPlayerController.m */
;
};
...
@@ -173,7 +172,6 @@
...
@@ -173,7 +172,6 @@
isa
=
PBXFrameworksBuildPhase
;
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
903996951F447609005E77C2
/* AssetsLibrary.framework in Frameworks */
,
903996931F447604005E77C2
/* Photos.framework in Frameworks */
,
903996931F447604005E77C2
/* Photos.framework in Frameworks */
,
);
);
runOnlyForDeploymentPostprocessing
=
0
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
9e8f7ec8
...
@@ -30,22 +30,14 @@
...
@@ -30,22 +30,14 @@
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
_model
=
model
;
_model
=
model
;
if
(
iOS8Later
)
{
self
.
representedAssetIdentifier
=
model
.
asset
.
localIdentifier
;
self
.
representedAssetIdentifier
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
}
if
(
self
.
useCachedImage
&&
model
.
cachedImage
)
{
if
(
self
.
useCachedImage
&&
model
.
cachedImage
)
{
self
.
imageView
.
image
=
model
.
cachedImage
;
self
.
imageView
.
image
=
model
.
cachedImage
;
}
else
{
}
else
{
self
.
model
.
cachedImage
=
nil
;
self
.
model
.
cachedImage
=
nil
;
int32_t
imageRequestID
=
[[
TZImageManager
manager
]
getPhotoWithAsset
:
model
.
asset
photoWidth
:
self
.
tz_width
completion
:^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
int32_t
imageRequestID
=
[[
TZImageManager
manager
]
getPhotoWithAsset
:
model
.
asset
photoWidth
:
self
.
tz_width
completion
:^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
// Set the cell's thumbnail image if it's still showing the same asset.
// Set the cell's thumbnail image if it's still showing the same asset.
if
(
!
iOS8Later
)
{
if
([
self
.
representedAssetIdentifier
isEqualToString
:
model
.
asset
.
localIdentifier
])
{
self
.
imageView
.
image
=
photo
;
self
.
model
.
cachedImage
=
photo
;
[
self
hideProgressView
];
return
;
}
if
([
self
.
representedAssetIdentifier
isEqualToString
:[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
]])
{
self
.
imageView
.
image
=
photo
;
self
.
imageView
.
image
=
photo
;
self
.
model
.
cachedImage
=
photo
;
self
.
model
.
cachedImage
=
photo
;
}
else
{
}
else
{
...
@@ -385,7 +377,7 @@
...
@@ -385,7 +377,7 @@
/// For fitting iOS6
/// For fitting iOS6
-
(
void
)
layoutSubviews
{
-
(
void
)
layoutSubviews
{
if
(
iOS7Later
)
[
super
layoutSubviews
];
[
super
layoutSubviews
];
_selectedCountButton
.
frame
=
CGRectMake
(
self
.
tz_width
-
24
-
30
,
23
,
24
,
24
);
_selectedCountButton
.
frame
=
CGRectMake
(
self
.
tz_width
-
24
-
30
,
23
,
24
,
24
);
NSInteger
titleHeight
=
ceil
(
self
.
titleLabel
.
font
.
lineHeight
);
NSInteger
titleHeight
=
ceil
(
self
.
titleLabel
.
font
.
lineHeight
);
self
.
titleLabel
.
frame
=
CGRectMake
(
80
,
(
self
.
tz_height
-
titleHeight
)
/
2
,
self
.
tz_width
-
80
-
50
,
titleHeight
);
self
.
titleLabel
.
frame
=
CGRectMake
(
80
,
(
self
.
tz_height
-
titleHeight
)
/
2
,
self
.
tz_width
-
80
-
50
,
titleHeight
);
...
@@ -397,7 +389,7 @@
...
@@ -397,7 +389,7 @@
}
}
-
(
void
)
layoutSublayersOfLayer
:(
CALayer
*
)
layer
{
-
(
void
)
layoutSublayersOfLayer
:(
CALayer
*
)
layer
{
if
(
iOS7Later
)
[
super
layoutSublayersOfLayer
:
layer
];
[
super
layoutSublayersOfLayer
:
layer
];
}
}
#pragma mark - Lazy load
#pragma mark - Lazy load
...
...
TZImagePickerController/TZImagePickerController/TZAssetModel.h
View file @
9e8f7ec8
...
@@ -20,17 +20,17 @@ typedef enum : NSUInteger {
...
@@ -20,17 +20,17 @@ typedef enum : NSUInteger {
@class
PHAsset
;
@class
PHAsset
;
@interface
TZAssetModel
:
NSObject
@interface
TZAssetModel
:
NSObject
@property
(
nonatomic
,
strong
)
id
asset
;
///< PHAsset or ALAsset
@property
(
nonatomic
,
strong
)
PHAsset
*
asset
;
@property
(
nonatomic
,
assign
)
BOOL
isSelected
;
///< The select status of a photo, default is No
@property
(
nonatomic
,
assign
)
BOOL
isSelected
;
///< The select status of a photo, default is No
@property
(
nonatomic
,
assign
)
TZAssetModelMediaType
type
;
@property
(
nonatomic
,
assign
)
TZAssetModelMediaType
type
;
@property
(
assign
,
nonatomic
)
BOOL
needOscillatoryAnimation
;
@property
(
assign
,
nonatomic
)
BOOL
needOscillatoryAnimation
;
@property
(
nonatomic
,
copy
)
NSString
*
timeLength
;
@property
(
nonatomic
,
copy
)
NSString
*
timeLength
;
@property
(
strong
,
nonatomic
)
UIImage
*
cachedImage
;
@property
(
strong
,
nonatomic
)
UIImage
*
cachedImage
;
/// Init a photo dataModel With a
a
sset
/// Init a photo dataModel With a
PHA
sset
/// 用一个PHAsset
/ALAsset
实例,初始化一个照片模型
/// 用一个PHAsset实例,初始化一个照片模型
+
(
instancetype
)
modelWithAsset
:(
id
)
asset
type
:(
TZAssetModelMediaType
)
type
;
+
(
instancetype
)
modelWithAsset
:(
PHAsset
*
)
asset
type
:(
TZAssetModelMediaType
)
type
;
+
(
instancetype
)
modelWithAsset
:(
id
)
asset
type
:(
TZAssetModelMediaType
)
type
timeLength
:(
NSString
*
)
timeLength
;
+
(
instancetype
)
modelWithAsset
:(
PHAsset
*
)
asset
type
:(
TZAssetModelMediaType
)
type
timeLength
:(
NSString
*
)
timeLength
;
@end
@end
...
@@ -40,7 +40,7 @@ typedef enum : NSUInteger {
...
@@ -40,7 +40,7 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
strong
)
NSString
*
name
;
///< The album name
@property
(
nonatomic
,
strong
)
NSString
*
name
;
///< The album name
@property
(
nonatomic
,
assign
)
NSInteger
count
;
///< Count of photos the album contain
@property
(
nonatomic
,
assign
)
NSInteger
count
;
///< Count of photos the album contain
@property
(
nonatomic
,
strong
)
id
result
;
///< PHFetchResult<PHAsset> or ALAssetsGroup<ALAsset>
@property
(
nonatomic
,
strong
)
PHFetchResult
*
result
;
@property
(
nonatomic
,
strong
)
NSArray
*
models
;
@property
(
nonatomic
,
strong
)
NSArray
*
models
;
@property
(
nonatomic
,
strong
)
NSArray
*
selectedModels
;
@property
(
nonatomic
,
strong
)
NSArray
*
selectedModels
;
...
@@ -48,6 +48,6 @@ typedef enum : NSUInteger {
...
@@ -48,6 +48,6 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
assign
)
BOOL
isCameraRoll
;
@property
(
nonatomic
,
assign
)
BOOL
isCameraRoll
;
-
(
void
)
setResult
:(
id
)
result
needFetchAssets
:(
BOOL
)
needFetchAssets
;
-
(
void
)
setResult
:(
PHFetchResult
*
)
result
needFetchAssets
:(
BOOL
)
needFetchAssets
;
@end
@end
TZImagePickerController/TZImagePickerController/TZAssetModel.m
View file @
9e8f7ec8
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
@implementation
TZAssetModel
@implementation
TZAssetModel
+
(
instancetype
)
modelWithAsset
:(
id
)
asset
type
:(
TZAssetModelMediaType
)
type
{
+
(
instancetype
)
modelWithAsset
:(
PHAsset
*
)
asset
type
:(
TZAssetModelMediaType
)
type
{
TZAssetModel
*
model
=
[[
TZAssetModel
alloc
]
init
];
TZAssetModel
*
model
=
[[
TZAssetModel
alloc
]
init
];
model
.
asset
=
asset
;
model
.
asset
=
asset
;
model
.
isSelected
=
NO
;
model
.
isSelected
=
NO
;
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
return
model
;
return
model
;
}
}
+
(
instancetype
)
modelWithAsset
:(
id
)
asset
type
:(
TZAssetModelMediaType
)
type
timeLength
:(
NSString
*
)
timeLength
{
+
(
instancetype
)
modelWithAsset
:(
PHAsset
*
)
asset
type
:(
TZAssetModelMediaType
)
type
timeLength
:(
NSString
*
)
timeLength
{
TZAssetModel
*
model
=
[
self
modelWithAsset
:
asset
type
:
type
];
TZAssetModel
*
model
=
[
self
modelWithAsset
:
asset
type
:
type
];
model
.
timeLength
=
timeLength
;
model
.
timeLength
=
timeLength
;
return
model
;
return
model
;
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
@implementation
TZAlbumModel
@implementation
TZAlbumModel
-
(
void
)
setResult
:(
id
)
result
needFetchAssets
:(
BOOL
)
needFetchAssets
{
-
(
void
)
setResult
:(
PHFetchResult
*
)
result
needFetchAssets
:(
BOOL
)
needFetchAssets
{
_result
=
result
;
_result
=
result
;
if
(
needFetchAssets
)
{
if
(
needFetchAssets
)
{
[[
TZImageManager
manager
]
getAssetsFromFetchResult
:
result
completion
:
^
(
NSArray
<
TZAssetModel
*>
*
models
)
{
[[
TZImageManager
manager
]
getAssetsFromFetchResult
:
result
completion
:
^
(
NSArray
<
TZAssetModel
*>
*
models
)
{
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
[
selectedAssets
addObject
:
model
.
asset
];
[
selectedAssets
addObject
:
model
.
asset
];
}
}
for
(
TZAssetModel
*
model
in
_models
)
{
for
(
TZAssetModel
*
model
in
_models
)
{
if
([
[
TZImageManager
manager
]
isAssetsArray
:
selectedAssets
containAsse
t
:
model
.
asset
])
{
if
([
selectedAssets
containsObjec
t
:
model
.
asset
])
{
self
.
selectedCount
++
;
self
.
selectedCount
++
;
}
}
}
}
...
...
TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m
View file @
9e8f7ec8
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
_originStatusBarStyle
=
[
UIApplication
sharedApplication
].
statusBarStyle
;
_originStatusBarStyle
=
[
UIApplication
sharedApplication
].
statusBarStyle
;
[
UIApplication
sharedApplication
].
statusBarStyle
=
iOS7Later
?
UIStatusBarStyleLightContent
:
UIStatusBarStyleBlackOpaque
;
[
UIApplication
sharedApplication
].
statusBarStyle
=
UIStatusBarStyleLightContent
;
}
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
...
@@ -119,12 +119,10 @@
...
@@ -119,12 +119,10 @@
_toolBar
.
hidden
=
!
_toolBar
.
isHidden
;
_toolBar
.
hidden
=
!
_toolBar
.
isHidden
;
[
self
.
navigationController
setNavigationBarHidden
:
_toolBar
.
isHidden
];
[
self
.
navigationController
setNavigationBarHidden
:
_toolBar
.
isHidden
];
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
iOS7Later
)
{
if
(
_toolBar
.
isHidden
)
{
if
(
_toolBar
.
isHidden
)
{
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
}
else
if
(
tzImagePickerVc
.
needShowStatusBar
)
{
}
else
if
(
tzImagePickerVc
.
needShowStatusBar
)
{
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
}
}
}
}
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.h
View file @
9e8f7ec8
...
@@ -54,26 +54,26 @@
...
@@ -54,26 +54,26 @@
-
(
void
)
getAllAlbums
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
needFetchAssets
:(
BOOL
)
needFetchAssets
completion
:(
void
(
^
)(
NSArray
<
TZAlbumModel
*>
*
models
))
completion
;
-
(
void
)
getAllAlbums
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
needFetchAssets
:(
BOOL
)
needFetchAssets
completion
:(
void
(
^
)(
NSArray
<
TZAlbumModel
*>
*
models
))
completion
;
/// Get Assets 获得Asset数组
/// Get Assets 获得Asset数组
-
(
void
)
getAssetsFromFetchResult
:(
id
)
result
completion
:(
void
(
^
)(
NSArray
<
TZAssetModel
*>
*
models
))
completion
;
-
(
void
)
getAssetsFromFetchResult
:(
PHFetchResult
*
)
result
completion
:(
void
(
^
)(
NSArray
<
TZAssetModel
*>
*
models
))
completion
;
-
(
void
)
getAssetsFromFetchResult
:(
id
)
result
allowPickingVideo
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
completion
:(
void
(
^
)(
NSArray
<
TZAssetModel
*>
*
models
))
completion
;
-
(
void
)
getAssetsFromFetchResult
:(
PHFetchResult
*
)
result
allowPickingVideo
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
completion
:(
void
(
^
)(
NSArray
<
TZAssetModel
*>
*
models
))
completion
;
-
(
void
)
getAssetFromFetchResult
:(
id
)
result
atIndex
:(
NSInteger
)
index
allowPickingVideo
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
completion
:(
void
(
^
)(
TZAssetModel
*
model
))
completion
;
-
(
void
)
getAssetFromFetchResult
:(
PHFetchResult
*
)
result
atIndex
:(
NSInteger
)
index
allowPickingVideo
:(
BOOL
)
allowPickingVideo
allowPickingImage
:(
BOOL
)
allowPickingImage
completion
:(
void
(
^
)(
TZAssetModel
*
model
))
completion
;
/// Get photo 获得照片
/// Get photo 获得照片
-
(
void
)
getPostImageWithAlbumModel
:(
TZAlbumModel
*
)
model
completion
:(
void
(
^
)(
UIImage
*
postImage
))
completion
;
-
(
void
)
getPostImageWithAlbumModel
:(
TZAlbumModel
*
)
model
completion
:(
void
(
^
)(
UIImage
*
postImage
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
PHAsset
*
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
getPhotoWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
getPhotoWithAsset
:(
id
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
getPhotoWithAsset
:(
PHAsset
*
)
asset
photoWidth
:(
CGFloat
)
photoWidth
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
networkAccessAllowed
:(
BOOL
)
networkAccessAllowed
;
-
(
int32_t
)
requestImageDataForAsset
:(
id
)
asset
completion
:(
void
(
^
)(
NSData
*
imageData
,
NSString
*
dataUTI
,
UIImageOrientation
orientation
,
NSDictionary
*
info
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
;
-
(
int32_t
)
requestImageDataForAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
NSData
*
imageData
,
NSString
*
dataUTI
,
UIImageOrientation
orientation
,
NSDictionary
*
info
))
completion
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
;
/// Get full Image 获取原图
/// Get full Image 获取原图
/// 如下两个方法completion一般会调多次,一般会先返回缩略图,再返回原图(详见方法内部使用的系统API的说明),如果info[PHImageResultIsDegradedKey] 为 YES,则表明当前返回的是缩略图,否则是原图。
/// 如下两个方法completion一般会调多次,一般会先返回缩略图,再返回原图(详见方法内部使用的系统API的说明),如果info[PHImageResultIsDegradedKey] 为 YES,则表明当前返回的是缩略图,否则是原图。
-
(
void
)
getOriginalPhotoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
))
completion
;
-
(
void
)
getOriginalPhotoWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
))
completion
;
-
(
void
)
getOriginalPhotoWithAsset
:(
id
)
asset
newCompletion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
void
)
getOriginalPhotoWithAsset
:(
PHAsset
*
)
asset
newCompletion
:(
void
(
^
)(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
// 该方法中,completion只会走一次
// 该方法中,completion只会走一次
-
(
void
)
getOriginalPhotoDataWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
NSData
*
data
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
void
)
getOriginalPhotoDataWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
NSData
*
data
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
void
)
getOriginalPhotoDataWithAsset
:(
id
)
asset
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
completion
:(
void
(
^
)(
NSData
*
data
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
-
(
void
)
getOriginalPhotoDataWithAsset
:(
PHAsset
*
)
asset
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
completion
:(
void
(
^
)(
NSData
*
data
,
NSDictionary
*
info
,
BOOL
isDegraded
))
completion
;
/// Save photo 保存照片
/// Save photo 保存照片
-
(
void
)
savePhotoWithImage
:(
UIImage
*
)
image
completion
:(
void
(
^
)(
NSError
*
error
))
completion
;
-
(
void
)
savePhotoWithImage
:(
UIImage
*
)
image
completion
:(
void
(
^
)(
NSError
*
error
))
completion
;
...
@@ -84,38 +84,33 @@
...
@@ -84,38 +84,33 @@
-
(
void
)
saveVideoWithUrl
:(
NSURL
*
)
url
location
:(
CLLocation
*
)
location
completion
:(
void
(
^
)(
NSError
*
error
))
completion
;
-
(
void
)
saveVideoWithUrl
:(
NSURL
*
)
url
location
:(
CLLocation
*
)
location
completion
:(
void
(
^
)(
NSError
*
error
))
completion
;
/// Get video 获得视频
/// Get video 获得视频
-
(
void
)
getVideoWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
AVPlayerItem
*
playerItem
,
NSDictionary
*
info
))
completion
;
-
(
void
)
getVideoWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
AVPlayerItem
*
playerItem
,
NSDictionary
*
info
))
completion
;
-
(
void
)
getVideoWithAsset
:(
id
)
asset
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
completion
:(
void
(
^
)(
AVPlayerItem
*
,
NSDictionary
*
))
completion
;
-
(
void
)
getVideoWithAsset
:(
PHAsset
*
)
asset
progressHandler
:(
void
(
^
)(
double
progress
,
NSError
*
error
,
BOOL
*
stop
,
NSDictionary
*
info
))
progressHandler
completion
:(
void
(
^
)(
AVPlayerItem
*
,
NSDictionary
*
))
completion
;
/// Export video 导出视频 presetName: 预设名字,默认值是AVAssetExportPreset640x480
/// Export video 导出视频 presetName: 预设名字,默认值是AVAssetExportPreset640x480
-
(
void
)
getVideoOutputPathWithAsset
:(
id
)
asset
success
:(
void
(
^
)(
NSString
*
outputPath
))
success
failure
:(
void
(
^
)(
NSString
*
errorMessage
,
NSError
*
error
))
failure
;
-
(
void
)
getVideoOutputPathWithAsset
:(
PHAsset
*
)
asset
success
:(
void
(
^
)(
NSString
*
outputPath
))
success
failure
:(
void
(
^
)(
NSString
*
errorMessage
,
NSError
*
error
))
failure
;
-
(
void
)
getVideoOutputPathWithAsset
:(
id
)
asset
presetName
:(
NSString
*
)
presetName
success
:(
void
(
^
)(
NSString
*
outputPath
))
success
failure
:(
void
(
^
)(
NSString
*
errorMessage
,
NSError
*
error
))
failure
;
-
(
void
)
getVideoOutputPathWithAsset
:(
PHAsset
*
)
asset
presetName
:(
NSString
*
)
presetName
success
:(
void
(
^
)(
NSString
*
outputPath
))
success
failure
:(
void
(
^
)(
NSString
*
errorMessage
,
NSError
*
error
))
failure
;
/// Deprecated, Use -getVideoOutputPathWithAsset:failure:success:
/// Deprecated, Use -getVideoOutputPathWithAsset:failure:success:
-
(
void
)
getVideoOutputPathWithAsset
:(
id
)
asset
completion
:(
void
(
^
)(
NSString
*
outputPath
))
completion
__attribute__
((
deprecated
(
"Use -getVideoOutputPathWithAsset:failure:success:"
)));
-
(
void
)
getVideoOutputPathWithAsset
:(
PHAsset
*
)
asset
completion
:(
void
(
^
)(
NSString
*
outputPath
))
completion
__attribute__
((
deprecated
(
"Use -getVideoOutputPathWithAsset:failure:success:"
)));
/// Get photo bytes 获得一组照片的大小
/// Get photo bytes 获得一组照片的大小
-
(
void
)
getPhotosBytesWithArray
:(
NSArray
*
)
photos
completion
:(
void
(
^
)(
NSString
*
totalBytes
))
completion
;
-
(
void
)
getPhotosBytesWithArray
:(
NSArray
*
)
photos
completion
:(
void
(
^
)(
NSString
*
totalBytes
))
completion
;
/// Judge is a assets array contain the asset 判断一个assets数组是否包含这个asset
-
(
BOOL
)
isCameraRollAlbum
:(
PHAssetCollection
*
)
metadata
;
-
(
BOOL
)
isAssetsArray
:(
NSArray
*
)
assets
containAsset
:(
id
)
asset
;
-
(
NSString
*
)
getAssetIdentifier
:(
id
)
asset
;
-
(
BOOL
)
isCameraRollAlbum
:(
id
)
metadata
;
/// 检查照片大小是否满足最小要求
/// 检查照片大小是否满足最小要求
-
(
BOOL
)
isPhotoSelectableWithAsset
:(
id
)
asset
;
-
(
BOOL
)
isPhotoSelectableWithAsset
:(
PHAsset
*
)
asset
;
-
(
CGSize
)
photoSizeWithAsset
:(
id
)
asset
;
/// 修正图片转向
/// 修正图片转向
-
(
UIImage
*
)
fixOrientation
:(
UIImage
*
)
aImage
;
-
(
UIImage
*
)
fixOrientation
:(
UIImage
*
)
aImage
;
/// 获取asset的资源类型
/// 获取asset的资源类型
-
(
TZAssetModelMediaType
)
getAssetType
:(
id
)
asset
;
-
(
TZAssetModelMediaType
)
getAssetType
:(
PHAsset
*
)
asset
;
/// 缩放图片至新尺寸
/// 缩放图片至新尺寸
-
(
UIImage
*
)
scaleImage
:(
UIImage
*
)
image
toSize
:(
CGSize
)
size
;
-
(
UIImage
*
)
scaleImage
:(
UIImage
*
)
image
toSize
:(
CGSize
)
size
;
/// 判断asset是否是视频
/// 判断asset是否是视频
-
(
BOOL
)
isVideo
:(
id
)
asset
;
-
(
BOOL
)
isVideo
:(
PHAsset
*
)
asset
;
@end
@end
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
9e8f7ec8
This diff is collapsed.
Click to expand it.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
9e8f7ec8
...
@@ -25,9 +25,6 @@
...
@@ -25,9 +25,6 @@
#import "TZLocationManager.h"
#import "TZLocationManager.h"
#import "TZPhotoPreviewController.h"
#import "TZPhotoPreviewController.h"
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
@class
TZAlbumCell
,
TZAssetCell
;
@class
TZAlbumCell
,
TZAssetCell
;
@
protocol
TZImagePickerControllerDelegate
;
@
protocol
TZImagePickerControllerDelegate
;
@interface
TZImagePickerController
:
UINavigationController
@interface
TZImagePickerController
:
UINavigationController
...
@@ -40,7 +37,7 @@
...
@@ -40,7 +37,7 @@
/// This init method just for previewing photos / 用这个初始化方法以预览图片
/// This init method just for previewing photos / 用这个初始化方法以预览图片
-
(
instancetype
)
initWithSelectedAssets
:(
NSMutableArray
*
)
selectedAssets
selectedPhotos
:(
NSMutableArray
*
)
selectedPhotos
index
:(
NSInteger
)
index
;
-
(
instancetype
)
initWithSelectedAssets
:(
NSMutableArray
*
)
selectedAssets
selectedPhotos
:(
NSMutableArray
*
)
selectedPhotos
index
:(
NSInteger
)
index
;
/// This init method for crop photo / 用这个初始化方法以裁剪图片
/// This init method for crop photo / 用这个初始化方法以裁剪图片
-
(
instancetype
)
initCropTypeWithAsset
:(
id
)
asset
photo
:(
UIImage
*
)
photo
completion
:(
void
(
^
)(
UIImage
*
cropImage
,
id
asset
))
completion
;
-
(
instancetype
)
initCropTypeWithAsset
:(
PHAsset
*
)
asset
photo
:(
UIImage
*
)
photo
completion
:(
void
(
^
)(
UIImage
*
cropImage
,
PHAsset
*
asset
))
completion
;
#pragma mark -
#pragma mark -
/// Default is 9 / 默认最大可选9张图片
/// Default is 9 / 默认最大可选9张图片
...
@@ -185,8 +182,8 @@
...
@@ -185,8 +182,8 @@
@property
(
nonatomic
,
copy
)
void
(
^
albumCellDidLayoutSubviewsBlock
)(
TZAlbumCell
*
cell
,
UIImageView
*
posterImageView
,
UILabel
*
titleLabel
);
@property
(
nonatomic
,
copy
)
void
(
^
albumCellDidLayoutSubviewsBlock
)(
TZAlbumCell
*
cell
,
UIImageView
*
posterImageView
,
UILabel
*
titleLabel
);
#pragma mark -
#pragma mark -
-
(
id
)
showAlertWithTitle
:(
NSString
*
)
title
;
-
(
UIAlertController
*
)
showAlertWithTitle
:(
NSString
*
)
title
;
-
(
void
)
hideAlertView
:(
id
)
alertView
;
-
(
void
)
hideAlertView
:(
UIAlertController
*
)
alertView
;
-
(
void
)
showProgressHUD
;
-
(
void
)
showProgressHUD
;
-
(
void
)
hideProgressHUD
;
-
(
void
)
hideProgressHUD
;
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
...
@@ -247,10 +244,8 @@
...
@@ -247,10 +244,8 @@
@property
(
nonatomic
,
copy
)
void
(
^
imagePickerControllerDidCancelHandle
)(
void
);
@property
(
nonatomic
,
copy
)
void
(
^
imagePickerControllerDidCancelHandle
)(
void
);
// If user picking a video, this handle will be called.
// If user picking a video, this handle will be called.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
// 如果用户选择了一个视频,下面的handle会被执行
// 如果用户选择了一个视频,下面的handle会被执行
// 如果系统版本大于iOS8,asset是PHAsset类的对象,否则是ALAsset类的对象
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingVideoHandle
)(
UIImage
*
coverImage
,
PHAsset
*
asset
);
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingVideoHandle
)(
UIImage
*
coverImage
,
id
asset
);
// If user picking a gif image, this callback will be called.
// If user picking a gif image, this callback will be called.
// 如果用户选择了一个gif图片,下面的handle会被执行
// 如果用户选择了一个gif图片,下面的handle会被执行
...
@@ -279,22 +274,20 @@
...
@@ -279,22 +274,20 @@
-
(
void
)
tz_imagePickerControllerDidCancel
:(
TZImagePickerController
*
)
picker
;
-
(
void
)
tz_imagePickerControllerDidCancel
:(
TZImagePickerController
*
)
picker
;
// If user picking a video, this callback will be called.
// If user picking a video, this callback will be called.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
// 如果用户选择了一个视频,下面的handle会被执行
// 如果用户选择了一个视频,下面的handle会被执行
// 如果系统版本大于iOS8,asset是PHAsset类的对象,否则是ALAsset类的对象
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingVideo
:(
UIImage
*
)
coverImage
sourceAssets
:(
PHAsset
*
)
asset
;
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingVideo
:(
UIImage
*
)
coverImage
sourceAssets
:(
id
)
asset
;
// If user picking a gif image, this callback will be called.
// If user picking a gif image, this callback will be called.
// 如果用户选择了一个gif图片,下面的handle会被执行
// 如果用户选择了一个gif图片,下面的handle会被执行
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingGifImage
:(
UIImage
*
)
animatedImage
sourceAssets
:(
id
)
asset
;
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingGifImage
:(
UIImage
*
)
animatedImage
sourceAssets
:(
PHAsset
*
)
asset
;
// Decide album show or not't
// Decide album show or not't
// 决定相册显示与否 albumName:相册名字 result:相册原始数据
// 决定相册显示与否 albumName:相册名字 result:相册原始数据
-
(
BOOL
)
isAlbumCanSelect
:(
NSString
*
)
albumName
result
:(
id
)
result
;
-
(
BOOL
)
isAlbumCanSelect
:(
NSString
*
)
albumName
result
:(
PHFetchResult
*
)
result
;
// Decide asset show or not't
// Decide asset show or not't
// 决定照片显示与否
// 决定照片显示与否
-
(
BOOL
)
isAssetCanSelect
:(
id
)
asset
;
-
(
BOOL
)
isAssetCanSelect
:(
PHAsset
*
)
asset
;
@end
@end
...
@@ -310,12 +303,6 @@
...
@@ -310,12 +303,6 @@
@end
@end
@interface
NSString
(
TzExtension
)
-
(
BOOL
)
tz_containsString
:(
NSString
*
)
string
;
-
(
CGSize
)
tz_calculateSizeWithAttributes
:(
NSDictionary
*
)
attributes
maxSize
:(
CGSize
)
maxSize
;
@end
@interface
TZCommonTools
:
NSObject
@interface
TZCommonTools
:
NSObject
+
(
BOOL
)
tz_isIPhoneX
;
+
(
BOOL
)
tz_isIPhoneX
;
+
(
CGFloat
)
tz_statusBarHeight
;
+
(
CGFloat
)
tz_statusBarHeight
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
9e8f7ec8
...
@@ -60,19 +60,15 @@
...
@@ -60,19 +60,15 @@
self
.
oKButtonTitleColorNormal
=
[
UIColor
colorWithRed
:(
83
/
255
.
0
)
green
:(
179
/
255
.
0
)
blue
:
(
17
/
255
.
0
)
alpha
:
1
.
0
];
self
.
oKButtonTitleColorNormal
=
[
UIColor
colorWithRed
:(
83
/
255
.
0
)
green
:(
179
/
255
.
0
)
blue
:
(
17
/
255
.
0
)
alpha
:
1
.
0
];
self
.
oKButtonTitleColorDisabled
=
[
UIColor
colorWithRed
:(
83
/
255
.
0
)
green
:(
179
/
255
.
0
)
blue
:
(
17
/
255
.
0
)
alpha
:
0
.
5
];
self
.
oKButtonTitleColorDisabled
=
[
UIColor
colorWithRed
:(
83
/
255
.
0
)
green
:(
179
/
255
.
0
)
blue
:
(
17
/
255
.
0
)
alpha
:
0
.
5
];
if
(
iOS7Later
)
{
self
.
navigationBar
.
barTintColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
1
.
0
];
self
.
navigationBar
.
barTintColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
1
.
0
];
self
.
navigationBar
.
tintColor
=
[
UIColor
whiteColor
];
self
.
navigationBar
.
tintColor
=
[
UIColor
whiteColor
];
self
.
automaticallyAdjustsScrollViewInsets
=
NO
;
self
.
automaticallyAdjustsScrollViewInsets
=
NO
;
if
(
self
.
needShowStatusBar
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
if
(
self
.
needShowStatusBar
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
}
}
-
(
void
)
setNaviBgColor
:(
UIColor
*
)
naviBgColor
{
-
(
void
)
setNaviBgColor
:(
UIColor
*
)
naviBgColor
{
_naviBgColor
=
naviBgColor
;
_naviBgColor
=
naviBgColor
;
if
(
iOS7Later
)
{
self
.
navigationBar
.
barTintColor
=
naviBgColor
;
self
.
navigationBar
.
barTintColor
=
naviBgColor
;
}
}
}
-
(
void
)
setNaviTitleColor
:(
UIColor
*
)
naviTitleColor
{
-
(
void
)
setNaviTitleColor
:(
UIColor
*
)
naviTitleColor
{
...
@@ -110,9 +106,9 @@
...
@@ -110,9 +106,9 @@
_isStatusBarDefault
=
isStatusBarDefault
;
_isStatusBarDefault
=
isStatusBarDefault
;
if
(
isStatusBarDefault
)
{
if
(
isStatusBarDefault
)
{
self
.
statusBarStyle
=
iOS7Later
?
UIStatusBarStyleDefault
:
UIStatusBarStyleBlackOpaque
;
self
.
statusBarStyle
=
UIStatusBarStyleDefault
;
}
else
{
}
else
{
self
.
statusBarStyle
=
iOS7Later
?
UIStatusBarStyleLightContent
:
UIStatusBarStyleBlackOpaque
;
self
.
statusBarStyle
=
UIStatusBarStyleLightContent
;
}
}
}
}
...
@@ -192,14 +188,12 @@
...
@@ -192,14 +188,12 @@
_tipLabel
.
text
=
tipText
;
_tipLabel
.
text
=
tipText
;
[
self
.
view
addSubview
:
_tipLabel
];
[
self
.
view
addSubview
:
_tipLabel
];
if
(
iOS8Later
)
{
_settingBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
_settingBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
[
_settingBtn
setTitle
:
self
.
settingBtnTitleStr
forState
:
UIControlStateNormal
];
[
_settingBtn
setTitle
:
self
.
settingBtnTitleStr
forState
:
UIControlStateNormal
];
_settingBtn
.
frame
=
CGRectMake
(
0
,
180
,
self
.
view
.
tz_width
,
44
);
_settingBtn
.
frame
=
CGRectMake
(
0
,
180
,
self
.
view
.
tz_width
,
44
);
_settingBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
18
];
_settingBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
18
];
[
_settingBtn
addTarget
:
self
action
:
@selector
(
settingBtnClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_settingBtn
addTarget
:
self
action
:
@selector
(
settingBtnClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
view
addSubview
:
_settingBtn
];
[
self
.
view
addSubview
:
_settingBtn
];
}
if
([
TZImageManager
authorizationStatus
]
==
0
)
{
if
([
TZImageManager
authorizationStatus
]
==
0
)
{
_timer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
0
.
2
target
:
self
selector
:
@selector
(
observeAuthrizationStatusChange
)
userInfo
:
nil
repeats
:
NO
];
_timer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
0
.
2
target
:
self
selector
:
@selector
(
observeAuthrizationStatusChange
)
userInfo
:
nil
repeats
:
NO
];
...
@@ -237,7 +231,7 @@
...
@@ -237,7 +231,7 @@
}
}
/// This init method for crop photo / 用这个初始化方法以裁剪图片
/// This init method for crop photo / 用这个初始化方法以裁剪图片
-
(
instancetype
)
initCropTypeWithAsset
:(
id
)
asset
photo
:(
UIImage
*
)
photo
completion
:(
void
(
^
)(
UIImage
*
cropImage
,
id
asset
))
completion
{
-
(
instancetype
)
initCropTypeWithAsset
:(
PHAsset
*
)
asset
photo
:(
UIImage
*
)
photo
completion
:(
void
(
^
)(
UIImage
*
cropImage
,
PHAsset
*
asset
))
completion
{
TZPhotoPreviewController
*
previewVc
=
[[
TZPhotoPreviewController
alloc
]
init
];
TZPhotoPreviewController
*
previewVc
=
[[
TZPhotoPreviewController
alloc
]
init
];
self
=
[
super
initWithRootViewController
:
previewVc
];
self
=
[
super
initWithRootViewController
:
previewVc
];
if
(
self
)
{
if
(
self
)
{
...
@@ -402,27 +396,15 @@
...
@@ -402,27 +396,15 @@
}
}
}
}
-
(
id
)
showAlertWithTitle
:(
NSString
*
)
title
{
-
(
UIAlertController
*
)
showAlertWithTitle
:(
NSString
*
)
title
{
if
(
iOS8Later
)
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
title
message
:
nil
preferredStyle
:
UIAlertControllerStyleAlert
];
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
title
message
:
nil
preferredStyle
:
UIAlertControllerStyleAlert
];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"OK"
]
style
:
UIAlertActionStyleDefault
handler
:
nil
]];
[
alertController
addAction
:[
UIAlertAction
actionWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"OK"
]
style
:
UIAlertActionStyleDefault
handler
:
nil
]];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
return
alertController
;
return
alertController
;
}
else
{
UIAlertView
*
alertView
=
[[
UIAlertView
alloc
]
initWithTitle
:
title
message
:
nil
delegate
:
nil
cancelButtonTitle
:
[
NSBundle
tz_localizedStringForKey
:
@"OK"
]
otherButtonTitles
:
nil
,
nil
];
[
alertView
show
];
return
alertView
;
}
}
}
-
(
void
)
hideAlertView
:(
id
)
alertView
{
-
(
void
)
hideAlertView
:(
UIAlertController
*
)
alertView
{
if
([
alertView
isKindOfClass
:[
UIAlertController
class
]])
{
[
alertView
dismissViewControllerAnimated
:
YES
completion
:
nil
];
UIAlertController
*
alertC
=
alertView
;
[
alertC
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
else
if
([
alertView
isKindOfClass
:[
UIAlertView
class
]])
{
UIAlertView
*
alertV
=
alertView
;
[
alertV
dismissWithClickedButtonIndex
:
0
animated
:
YES
];
}
alertView
=
nil
;
alertView
=
nil
;
}
}
...
@@ -564,7 +546,7 @@
...
@@ -564,7 +546,7 @@
_selectedAssets
=
selectedAssets
;
_selectedAssets
=
selectedAssets
;
_selectedModels
=
[
NSMutableArray
array
];
_selectedModels
=
[
NSMutableArray
array
];
_selectedAssetIds
=
[
NSMutableArray
array
];
_selectedAssetIds
=
[
NSMutableArray
array
];
for
(
id
asset
in
selectedAssets
)
{
for
(
PHAsset
*
asset
in
selectedAssets
)
{
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:[[
TZImageManager
manager
]
getAssetType
:
asset
]];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:[[
TZImageManager
manager
]
getAssetType
:
asset
]];
model
.
isSelected
=
YES
;
model
.
isSelected
=
YES
;
[
self
addSelectedModel
:
model
];
[
self
addSelectedModel
:
model
];
...
@@ -609,9 +591,7 @@
...
@@ -609,9 +591,7 @@
}
}
-
(
void
)
pushViewController
:(
UIViewController
*
)
viewController
animated
:(
BOOL
)
animated
{
-
(
void
)
pushViewController
:(
UIViewController
*
)
viewController
animated
:(
BOOL
)
animated
{
if
(
iOS7Later
)
{
viewController
.
automaticallyAdjustsScrollViewInsets
=
NO
;
viewController
.
automaticallyAdjustsScrollViewInsets
=
NO
;
}
[
super
pushViewController
:
viewController
animated
:
animated
];
[
super
pushViewController
:
viewController
animated
:
animated
];
}
}
...
@@ -621,14 +601,12 @@
...
@@ -621,14 +601,12 @@
-
(
void
)
addSelectedModel
:(
TZAssetModel
*
)
model
{
-
(
void
)
addSelectedModel
:(
TZAssetModel
*
)
model
{
[
_selectedModels
addObject
:
model
];
[
_selectedModels
addObject
:
model
];
NSString
*
assetId
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
[
_selectedAssetIds
addObject
:
model
.
asset
.
localIdentifier
];
[
_selectedAssetIds
addObject
:
assetId
];
}
}
-
(
void
)
removeSelectedModel
:(
TZAssetModel
*
)
model
{
-
(
void
)
removeSelectedModel
:(
TZAssetModel
*
)
model
{
[
_selectedModels
removeObject
:
model
];
[
_selectedModels
removeObject
:
model
];
NSString
*
assetId
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
[
_selectedAssetIds
removeObject
:
model
.
asset
.
localIdentifier
];
[
_selectedAssetIds
removeObject
:
assetId
];
}
}
-
(
UIImage
*
)
createImageWithColor
:(
UIColor
*
)
color
size
:(
CGSize
)
size
radius
:(
CGFloat
)
radius
{
-
(
UIImage
*
)
createImageWithColor
:(
UIColor
*
)
color
size
:(
CGSize
)
size
radius
:(
CGFloat
)
radius
{
...
@@ -650,7 +628,11 @@
...
@@ -650,7 +628,11 @@
#pragma mark - UIContentContainer
#pragma mark - UIContentContainer
-
(
void
)
viewWillTransitionToSize
:(
CGSize
)
size
withTransitionCoordinator
:(
id
<
UIViewControllerTransitionCoordinator
>
)
coordinator
{
-
(
void
)
viewWillTransitionToSize
:(
CGSize
)
size
withTransitionCoordinator
:(
id
<
UIViewControllerTransitionCoordinator
>
)
coordinator
{
[
self
willInterfaceOrientionChange
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
02
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
if
(
!
[
UIApplication
sharedApplication
].
statusBarHidden
)
{
if
(
self
.
needShowStatusBar
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
});
if
(
size
.
width
>
size
.
height
)
{
if
(
size
.
width
>
size
.
height
)
{
_cropRect
=
_cropRectLandscape
;
_cropRect
=
_cropRectLandscape
;
}
else
{
}
else
{
...
@@ -658,23 +640,6 @@
...
@@ -658,23 +640,6 @@
}
}
}
}
-
(
void
)
willAnimateRotationToInterfaceOrientation
:(
UIInterfaceOrientation
)
toInterfaceOrientation
duration
:(
NSTimeInterval
)
duration
{
[
self
willInterfaceOrientionChange
];
if
(
toInterfaceOrientation
>=
3
)
{
_cropRect
=
_cropRectLandscape
;
}
else
{
_cropRect
=
_cropRectPortrait
;
}
}
-
(
void
)
willInterfaceOrientionChange
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
02
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
if
(
!
[
UIApplication
sharedApplication
].
statusBarHidden
)
{
if
(
iOS7Later
&&
self
.
needShowStatusBar
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
});
}
#pragma mark - Layout
#pragma mark - Layout
-
(
void
)
viewDidLayoutSubviews
{
-
(
void
)
viewDidLayoutSubviews
{
...
@@ -799,7 +764,7 @@
...
@@ -799,7 +764,7 @@
BOOL
isStatusBarHidden
=
[
UIApplication
sharedApplication
].
isStatusBarHidden
;
BOOL
isStatusBarHidden
=
[
UIApplication
sharedApplication
].
isStatusBarHidden
;
if
(
self
.
navigationController
.
navigationBar
.
isTranslucent
)
{
if
(
self
.
navigationController
.
navigationBar
.
isTranslucent
)
{
top
=
naviBarHeight
;
top
=
naviBarHeight
;
if
(
iOS7Later
&&
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
tz_statusBarHeight
];
if
(
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
tz_statusBarHeight
];
tableViewHeight
=
self
.
view
.
tz_height
-
top
;
tableViewHeight
=
self
.
view
.
tz_height
-
top
;
}
else
{
}
else
{
tableViewHeight
=
self
.
view
.
tz_height
;
tableViewHeight
=
self
.
view
.
tz_height
;
...
@@ -856,33 +821,6 @@
...
@@ -856,33 +821,6 @@
@end
@end
@implementation
NSString
(
TzExtension
)
-
(
BOOL
)
tz_containsString
:(
NSString
*
)
string
{
if
(
iOS8Later
)
{
return
[
self
containsString
:
string
];
}
else
{
NSRange
range
=
[
self
rangeOfString
:
string
];
return
range
.
location
!=
NSNotFound
;
}
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
(
CGSize
)
tz_calculateSizeWithAttributes
:(
NSDictionary
*
)
attributes
maxSize
:(
CGSize
)
maxSize
{
CGSize
size
;
if
(
iOS7Later
)
{
size
=
[
self
boundingRectWithSize
:
maxSize
options
:
NSStringDrawingUsesFontLeading
attributes
:
attributes
context
:
nil
].
size
;
}
else
{
size
=
[
self
sizeWithFont
:
attributes
[
NSFontAttributeName
]
constrainedToSize
:
maxSize
];
}
return
size
;
}
#pragma clang diagnostic pop
@end
@implementation
TZCommonTools
@implementation
TZCommonTools
+
(
BOOL
)
tz_isIPhoneX
{
+
(
BOOL
)
tz_isIPhoneX
{
...
...
TZImagePickerController/TZImagePickerController/TZLocationManager.m
View file @
9e8f7ec8
...
@@ -28,9 +28,7 @@
...
@@ -28,9 +28,7 @@
manager
=
[[
self
alloc
]
init
];
manager
=
[[
self
alloc
]
init
];
manager
.
locationManager
=
[[
CLLocationManager
alloc
]
init
];
manager
.
locationManager
=
[[
CLLocationManager
alloc
]
init
];
manager
.
locationManager
.
delegate
=
manager
;
manager
.
locationManager
.
delegate
=
manager
;
if
(
iOS8Later
)
{
[
manager
.
locationManager
requestWhenInUseAuthorization
];
[
manager
.
locationManager
requestWhenInUseAuthorization
];
}
});
});
return
manager
;
return
manager
;
}
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
9e8f7ec8
This diff is collapsed.
Click to expand it.
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
View file @
9e8f7ec8
...
@@ -188,7 +188,7 @@
...
@@ -188,7 +188,7 @@
}
}
}
}
-
(
void
)
setAsset
:(
id
)
asset
{
-
(
void
)
setAsset
:(
PHAsset
*
)
asset
{
if
(
_asset
&&
self
.
imageRequestID
)
{
if
(
_asset
&&
self
.
imageRequestID
)
{
[[
PHImageManager
defaultManager
]
cancelImageRequest
:
self
.
imageRequestID
];
[[
PHImageManager
defaultManager
]
cancelImageRequest
:
self
.
imageRequestID
];
}
}
...
@@ -412,7 +412,7 @@
...
@@ -412,7 +412,7 @@
if
(
currentTime
.
value
==
durationTime
.
value
)
[
_player
.
currentItem
seekToTime
:
CMTimeMake
(
0
,
1
)];
if
(
currentTime
.
value
==
durationTime
.
value
)
[
_player
.
currentItem
seekToTime
:
CMTimeMake
(
0
,
1
)];
[
_player
play
];
[
_player
play
];
[
_playButton
setImage
:
nil
forState
:
UIControlStateNormal
];
[
_playButton
setImage
:
nil
forState
:
UIControlStateNormal
];
if
(
iOS7Later
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
if
(
self
.
singleTapGestureBlock
)
{
if
(
self
.
singleTapGestureBlock
)
{
self
.
singleTapGestureBlock
();
self
.
singleTapGestureBlock
();
}
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
9e8f7ec8
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
@property
(
nonatomic
,
strong
)
UIView
*
cropView
;
@property
(
nonatomic
,
strong
)
UIView
*
cropView
;
@property
(
nonatomic
,
assign
)
double
progress
;
@property
(
nonatomic
,
assign
)
double
progress
;
@property
(
strong
,
nonatomic
)
id
alertView
;
@property
(
strong
,
nonatomic
)
UIAlertController
*
alertView
;
@end
@end
@implementation
TZPhotoPreviewController
@implementation
TZPhotoPreviewController
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
animated
:
YES
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
animated
:
YES
];
if
(
iOS7Later
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
if
(
_currentIndex
)
[
_collectionView
setContentOffset
:
CGPointMake
((
self
.
view
.
tz_width
+
20
)
*
_currentIndex
,
0
)
animated
:
NO
];
if
(
_currentIndex
)
[
_collectionView
setContentOffset
:
CGPointMake
((
self
.
view
.
tz_width
+
20
)
*
_currentIndex
,
0
)
animated
:
NO
];
[
self
refreshNaviBarAndBottomBarState
];
[
self
refreshNaviBarAndBottomBarState
];
}
}
...
@@ -86,7 +86,7 @@
...
@@ -86,7 +86,7 @@
[
super
viewWillDisappear
:
animated
];
[
super
viewWillDisappear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
NO
animated
:
YES
];
[
self
.
navigationController
setNavigationBarHidden
:
NO
animated
:
YES
];
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
tzImagePickerVc
.
needShowStatusBar
&&
iOS7Later
)
{
if
(
tzImagePickerVc
.
needShowStatusBar
)
{
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
}
[
TZImageManager
manager
].
shouldFixOrientation
=
NO
;
[
TZImageManager
manager
].
shouldFixOrientation
=
NO
;
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
CGFloat
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
CGFloat
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
_toolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
_toolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
tz_calculateSizeWithAttributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
maxSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)]
.
width
;
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
width
;
_originalPhotoButton
.
frame
=
CGRectMake
(
0
,
0
,
fullImageWidth
+
56
,
44
);
_originalPhotoButton
.
frame
=
CGRectMake
(
0
,
0
,
fullImageWidth
+
56
,
44
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
}
}
...
@@ -315,7 +315,7 @@
...
@@ -315,7 +315,7 @@
}
else
{
}
else
{
NSArray
*
selectedModels
=
[
NSArray
arrayWithArray
:
_tzImagePickerVc
.
selectedModels
];
NSArray
*
selectedModels
=
[
NSArray
arrayWithArray
:
_tzImagePickerVc
.
selectedModels
];
for
(
TZAssetModel
*
model_item
in
selectedModels
)
{
for
(
TZAssetModel
*
model_item
in
selectedModels
)
{
if
([
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
]
isEqualToString
:[[
TZImageManager
manager
]
getAssetIdentifier
:
model_item
.
asset
]
])
{
if
([
model
.
asset
.
localIdentifier
isEqualToString
:
model_item
.
asset
.
localIdentifier
])
{
// 1.6.7版本更新:防止有多个一样的model,一次性被移除了
// 1.6.7版本更新:防止有多个一样的model,一次性被移除了
NSArray
*
selectedModelsTmp
=
[
NSArray
arrayWithArray
:
_tzImagePickerVc
.
selectedModels
];
NSArray
*
selectedModelsTmp
=
[
NSArray
arrayWithArray
:
_tzImagePickerVc
.
selectedModels
];
for
(
NSInteger
i
=
0
;
i
<
selectedModelsTmp
.
count
;
i
++
)
{
for
(
NSInteger
i
=
0
;
i
<
selectedModelsTmp
.
count
;
i
++
)
{
...
@@ -513,8 +513,7 @@
...
@@ -513,8 +513,7 @@
_selectButton
.
selected
=
model
.
isSelected
;
_selectButton
.
selected
=
model
.
isSelected
;
[
self
refreshSelectButtonImageViewContentMode
];
[
self
refreshSelectButtonImageViewContentMode
];
if
(
_selectButton
.
isSelected
&&
_tzImagePickerVc
.
showSelectedIndex
&&
_tzImagePickerVc
.
showSelectBtn
)
{
if
(
_selectButton
.
isSelected
&&
_tzImagePickerVc
.
showSelectedIndex
&&
_tzImagePickerVc
.
showSelectBtn
)
{
NSString
*
assetId
=
[[
TZImageManager
manager
]
getAssetIdentifier
:
model
.
asset
];
NSString
*
index
=
[
NSString
stringWithFormat
:
@"%zd"
,
[
_tzImagePickerVc
.
selectedAssetIds
indexOfObject
:
model
.
asset
.
localIdentifier
]
+
1
];
NSString
*
index
=
[
NSString
stringWithFormat
:
@"%zd"
,
[
_tzImagePickerVc
.
selectedAssetIds
indexOfObject
:
assetId
]
+
1
];
_indexLabel
.
text
=
index
;
_indexLabel
.
text
=
index
;
_indexLabel
.
hidden
=
NO
;
_indexLabel
.
hidden
=
NO
;
}
else
{
}
else
{
...
...
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
View file @
9e8f7ec8
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
_originStatusBarStyle
=
[
UIApplication
sharedApplication
].
statusBarStyle
;
_originStatusBarStyle
=
[
UIApplication
sharedApplication
].
statusBarStyle
;
[
UIApplication
sharedApplication
].
statusBarStyle
=
iOS7Later
?
UIStatusBarStyleLightContent
:
UIStatusBarStyleBlackOpaque
;
[
UIApplication
sharedApplication
].
statusBarStyle
=
UIStatusBarStyleLightContent
;
}
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
...
@@ -157,7 +157,7 @@
...
@@ -157,7 +157,7 @@
[
self
.
navigationController
setNavigationBarHidden
:
YES
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
];
_toolBar
.
hidden
=
YES
;
_toolBar
.
hidden
=
YES
;
[
_playButton
setImage
:
nil
forState
:
UIControlStateNormal
];
[
_playButton
setImage
:
nil
forState
:
UIControlStateNormal
];
if
(
iOS7Later
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
}
else
{
}
else
{
[
self
pausePlayerAndShowNaviBar
];
[
self
pausePlayerAndShowNaviBar
];
}
}
...
@@ -198,7 +198,7 @@
...
@@ -198,7 +198,7 @@
[
self
.
navigationController
setNavigationBarHidden
:
NO
];
[
self
.
navigationController
setNavigationBarHidden
:
NO
];
[
_playButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
@"MMVideoPreviewPlay"
]
forState
:
UIControlStateNormal
];
[
_playButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
@"MMVideoPreviewPlay"
]
forState
:
UIControlStateNormal
];
if
(
self
.
needShowStatusBar
&&
iOS7Later
)
{
if
(
self
.
needShowStatusBar
)
{
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
}
}
}
...
...
TZImagePickerController/TZTestCell.m
View file @
9e8f7ec8
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#import "TZTestCell.h"
#import "TZTestCell.h"
#import "UIView+Layout.h"
#import "UIView+Layout.h"
#import <Photos/Photos.h>
#import <Photos/Photos.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import "TZImagePickerController/TZImagePickerController.h"
#import "TZImagePickerController/TZImagePickerController.h"
@implementation
TZTestCell
@implementation
TZTestCell
...
@@ -56,18 +55,11 @@
...
@@ -56,18 +55,11 @@
_videoImageView
.
frame
=
CGRectMake
(
width
,
width
,
width
,
width
);
_videoImageView
.
frame
=
CGRectMake
(
width
,
width
,
width
,
width
);
}
}
-
(
void
)
setAsset
:(
id
)
asset
{
-
(
void
)
setAsset
:(
PHAsset
*
)
asset
{
_asset
=
asset
;
_asset
=
asset
;
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
_videoImageView
.
hidden
=
asset
.
mediaType
!=
PHAssetMediaTypeVideo
;
PHAsset
*
phAsset
=
asset
;
_gifLable
.
hidden
=
!
[[
asset
valueForKey
:
@"filename"
]
containsString
:
@"GIF"
];
_videoImageView
.
hidden
=
phAsset
.
mediaType
!=
PHAssetMediaTypeVideo
;
}
_gifLable
.
hidden
=
!
[[
phAsset
valueForKey
:
@"filename"
]
tz_containsString
:
@"GIF"
];
}
else
if
([
asset
isKindOfClass
:[
ALAsset
class
]])
{
ALAsset
*
alAsset
=
asset
;
_videoImageView
.
hidden
=
!
[[
alAsset
valueForProperty
:
ALAssetPropertyType
]
isEqualToString
:
ALAssetTypeVideo
];
_gifLable
.
hidden
=
YES
;
}
}
-
(
void
)
setRow
:(
NSInteger
)
row
{
-
(
void
)
setRow
:(
NSInteger
)
row
{
_row
=
row
;
_row
=
row
;
...
...
TZImagePickerController/ViewController.m
View file @
9e8f7ec8
This diff is collapsed.
Click to expand it.
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