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
1fe6744e
Commit
1fe6744e
authored
Jul 22, 2017
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Demo页支持横屏;支持视频&gif图片多选;支持同时选择图片/视频/gif图
parent
39467b90
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
468 additions
and
155 deletions
+468
-155
TZImagePickerController/Base.lproj/Main.storyboard
TZImagePickerController/Base.lproj/Main.storyboard
+114
-44
TZImagePickerController/TZImagePickerController/TZAssetCell.h
...agePickerController/TZImagePickerController/TZAssetCell.h
+1
-0
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+16
-13
TZImagePickerController/TZImagePickerController/TZImageManager.h
...PickerController/TZImagePickerController/TZImageManager.h
+4
-0
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+26
-15
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+2
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+2
-1
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+18
-12
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h
...erController/TZImagePickerController/TZPhotoPreviewCell.h
+25
-3
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
...erController/TZImagePickerController/TZPhotoPreviewCell.m
+166
-18
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+50
-32
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
...troller/TZImagePickerController/TZVideoPlayerController.m
+1
-0
TZImagePickerController/TZTestCell.m
TZImagePickerController/TZTestCell.m
+2
-2
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+41
-15
No files found.
TZImagePickerController/Base.lproj/Main.storyboard
View file @
1fe6744e
This diff is collapsed.
Click to expand it.
TZImagePickerController/TZImagePickerController/TZAssetCell.h
View file @
1fe6744e
...
@@ -25,6 +25,7 @@ typedef enum : NSUInteger {
...
@@ -25,6 +25,7 @@ typedef enum : NSUInteger {
@property
(
nonatomic
,
copy
)
void
(
^
didSelectPhotoBlock
)(
BOOL
);
@property
(
nonatomic
,
copy
)
void
(
^
didSelectPhotoBlock
)(
BOOL
);
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingGif
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingGif
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingMultipleVideo
;
@property
(
nonatomic
,
copy
)
NSString
*
representedAssetIdentifier
;
@property
(
nonatomic
,
copy
)
NSString
*
representedAssetIdentifier
;
@property
(
nonatomic
,
assign
)
int32_t
imageRequestID
;
@property
(
nonatomic
,
assign
)
int32_t
imageRequestID
;
...
...
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
1fe6744e
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
if
(
model
.
isSelected
)
{
if
(
model
.
isSelected
)
{
[
self
fetchBigImage
];
[
self
fetchBigImage
];
}
}
[
self
setNeedsLayout
];
}
}
-
(
void
)
setShowSelectBtn
:(
BOOL
)
showSelectBtn
{
-
(
void
)
setShowSelectBtn
:(
BOOL
)
showSelectBtn
{
...
@@ -83,25 +84,27 @@
...
@@ -83,25 +84,27 @@
-
(
void
)
setType
:(
TZAssetCellType
)
type
{
-
(
void
)
setType
:(
TZAssetCellType
)
type
{
_type
=
type
;
_type
=
type
;
if
(
type
==
TZAssetCellTypePhoto
||
type
==
TZAssetCellTypeLivePhoto
||
(
type
==
TZAssetCellTypePhotoGif
&&
!
self
.
allowPickingGif
))
{
if
(
type
==
TZAssetCellTypePhoto
||
type
==
TZAssetCellTypeLivePhoto
||
(
type
==
TZAssetCellTypePhotoGif
&&
!
self
.
allowPickingGif
)
||
self
.
allowPickingMultipleVideo
)
{
_selectImageView
.
hidden
=
NO
;
_selectImageView
.
hidden
=
NO
;
_selectPhotoButton
.
hidden
=
NO
;
_selectPhotoButton
.
hidden
=
NO
;
_bottomView
.
hidden
=
YES
;
_bottomView
.
hidden
=
YES
;
}
else
{
// Video of Gif
}
else
{
// Video of Gif
_selectImageView
.
hidden
=
YES
;
_selectImageView
.
hidden
=
YES
;
_selectPhotoButton
.
hidden
=
YES
;
_selectPhotoButton
.
hidden
=
YES
;
_bottomView
.
hidden
=
NO
;
}
if
(
type
==
TZAssetCellTypeVideo
)
{
self
.
timeLength
.
text
=
_model
.
timeLength
;
if
(
type
==
TZAssetCellTypeVideo
)
{
self
.
videoImgView
.
hidden
=
NO
;
self
.
bottomView
.
hidden
=
NO
;
_timeLength
.
tz_left
=
self
.
videoImgView
.
tz_right
;
self
.
timeLength
.
text
=
_model
.
timeLength
;
_timeLength
.
textAlignment
=
NSTextAlignmentRight
;
self
.
videoImgView
.
hidden
=
NO
;
}
else
{
_timeLength
.
tz_left
=
self
.
videoImgView
.
tz_right
;
self
.
timeLength
.
text
=
@"GIF"
;
_timeLength
.
textAlignment
=
NSTextAlignmentRight
;
self
.
videoImgView
.
hidden
=
YES
;
}
else
if
(
type
==
TZAssetCellTypePhotoGif
)
{
_timeLength
.
tz_left
=
5
;
self
.
bottomView
.
hidden
=
NO
;
_timeLength
.
textAlignment
=
NSTextAlignmentLeft
;
self
.
timeLength
.
text
=
@"GIF"
;
}
self
.
videoImgView
.
hidden
=
YES
;
_timeLength
.
tz_left
=
5
;
_timeLength
.
textAlignment
=
NSTextAlignmentLeft
;
}
}
}
}
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.h
View file @
1fe6744e
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import <AVFoundation/AVFoundation.h>
#import <Photos/Photos.h>
#import <Photos/Photos.h>
#import "TZAssetModel.h"
@class
TZAlbumModel
,
TZAssetModel
;
@class
TZAlbumModel
,
TZAssetModel
;
@
protocol
TZImagePickerControllerDelegate
;
@
protocol
TZImagePickerControllerDelegate
;
...
@@ -98,6 +99,9 @@
...
@@ -98,6 +99,9 @@
/// 修正图片转向
/// 修正图片转向
-
(
UIImage
*
)
fixOrientation
:(
UIImage
*
)
aImage
;
-
(
UIImage
*
)
fixOrientation
:(
UIImage
*
)
aImage
;
/// 获取asset的资源类型
-
(
TZAssetModelMediaType
)
getAssetType
:(
id
)
asset
;
@end
@end
//@interface TZSortDescriptor : NSSortDescriptor
//@interface TZSortDescriptor : NSSortDescriptor
...
...
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
1fe6744e
...
@@ -315,24 +315,13 @@ static dispatch_once_t onceToken;
...
@@ -315,24 +315,13 @@ static dispatch_once_t onceToken;
if
(
!
canSelect
)
return
nil
;
if
(
!
canSelect
)
return
nil
;
TZAssetModel
*
model
;
TZAssetModel
*
model
;
TZAssetModelMediaType
type
=
TZAssetModelMediaTypePhoto
;
TZAssetModelMediaType
type
=
[
self
getAssetType
:
asset
]
;
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
PHAsset
*
phAsset
=
(
PHAsset
*
)
asset
;
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeVideo
)
type
=
TZAssetModelMediaTypeVideo
;
else
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeAudio
)
type
=
TZAssetModelMediaTypeAudio
;
else
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeImage
)
{
if
(
iOS9_1Later
)
{
// if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto;
}
// Gif
if
([[
phAsset
valueForKey
:
@"filename"
]
hasSuffix
:
@"GIF"
])
{
type
=
TZAssetModelMediaTypePhotoGif
;
}
}
if
(
!
allowPickingVideo
&&
type
==
TZAssetModelMediaTypeVideo
)
return
nil
;
if
(
!
allowPickingVideo
&&
type
==
TZAssetModelMediaTypeVideo
)
return
nil
;
if
(
!
allowPickingImage
&&
type
==
TZAssetModelMediaTypePhoto
)
return
nil
;
if
(
!
allowPickingImage
&&
type
==
TZAssetModelMediaTypePhoto
)
return
nil
;
if
(
!
allowPickingImage
&&
type
==
TZAssetModelMediaTypePhotoGif
)
return
nil
;
if
(
!
allowPickingImage
&&
type
==
TZAssetModelMediaTypePhotoGif
)
return
nil
;
PHAsset
*
phAsset
=
(
PHAsset
*
)
asset
;
if
(
self
.
hideWhenCanNotSelect
)
{
if
(
self
.
hideWhenCanNotSelect
)
{
// 过滤掉尺寸不满足要求的图片
// 过滤掉尺寸不满足要求的图片
if
(
!
[
self
isPhotoSelectableWithAsset
:
phAsset
])
{
if
(
!
[
self
isPhotoSelectableWithAsset
:
phAsset
])
{
...
@@ -348,8 +337,7 @@ static dispatch_once_t onceToken;
...
@@ -348,8 +337,7 @@ static dispatch_once_t onceToken;
return
model
;
return
model
;
}
}
/// Allow picking video
/// Allow picking video
if
([[
asset
valueForProperty
:
ALAssetPropertyType
]
isEqualToString
:
ALAssetTypeVideo
])
{
if
(
type
==
TZAssetModelMediaTypeVideo
)
{
type
=
TZAssetModelMediaTypeVideo
;
NSTimeInterval
duration
=
[[
asset
valueForProperty
:
ALAssetPropertyDuration
]
doubleValue
];
NSTimeInterval
duration
=
[[
asset
valueForProperty
:
ALAssetPropertyDuration
]
doubleValue
];
NSString
*
timeLength
=
[
NSString
stringWithFormat
:
@"%0.0f"
,
duration
];
NSString
*
timeLength
=
[
NSString
stringWithFormat
:
@"%0.0f"
,
duration
];
timeLength
=
[
self
getNewTimeFromDurationSecond
:
timeLength
.
integerValue
];
timeLength
=
[
self
getNewTimeFromDurationSecond
:
timeLength
.
integerValue
];
...
@@ -367,6 +355,29 @@ static dispatch_once_t onceToken;
...
@@ -367,6 +355,29 @@ static dispatch_once_t onceToken;
return
model
;
return
model
;
}
}
-
(
TZAssetModelMediaType
)
getAssetType
:(
id
)
asset
{
TZAssetModelMediaType
type
=
TZAssetModelMediaTypePhoto
;
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
PHAsset
*
phAsset
=
(
PHAsset
*
)
asset
;
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeVideo
)
type
=
TZAssetModelMediaTypeVideo
;
else
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeAudio
)
type
=
TZAssetModelMediaTypeAudio
;
else
if
(
phAsset
.
mediaType
==
PHAssetMediaTypeImage
)
{
if
(
iOS9_1Later
)
{
// if (asset.mediaSubtypes == PHAssetMediaSubtypePhotoLive) type = TZAssetModelMediaTypeLivePhoto;
}
// Gif
if
([[
phAsset
valueForKey
:
@"filename"
]
hasSuffix
:
@"GIF"
])
{
type
=
TZAssetModelMediaTypePhotoGif
;
}
}
}
else
{
if
([[
asset
valueForProperty
:
ALAssetPropertyType
]
isEqualToString
:
ALAssetTypeVideo
])
{
type
=
TZAssetModelMediaTypeVideo
;
}
}
return
type
;
}
-
(
NSString
*
)
getNewTimeFromDurationSecond
:(
NSInteger
)
duration
{
-
(
NSString
*
)
getNewTimeFromDurationSecond
:(
NSInteger
)
duration
{
NSString
*
newTime
;
NSString
*
newTime
;
if
(
duration
<
10
)
{
if
(
duration
<
10
)
{
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
1fe6744e
...
@@ -71,6 +71,8 @@
...
@@ -71,6 +71,8 @@
/// Default is YES, if set NO, user can't picking video.
/// Default is YES, if set NO, user can't picking video.
/// 默认为YES,如果设置为NO,用户将不能选择视频
/// 默认为YES,如果设置为NO,用户将不能选择视频
@property
(
nonatomic
,
assign
)
BOOL
allowPickingVideo
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingVideo
;
/// Default is NO / 默认为NO,为YES时可以多选视频/gif图片,和照片共享最大可选张数maxImagesCount的限制
@property
(
nonatomic
,
assign
)
BOOL
allowPickingMultipleVideo
;
/// Default is NO, if set YES, user can picking gif image.
/// Default is NO, if set YES, user can picking gif image.
/// 默认为NO,如果设置为YES,用户可以选择gif图片
/// 默认为NO,如果设置为YES,用户可以选择gif图片
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
1fe6744e
...
@@ -54,6 +54,7 @@
...
@@ -54,6 +54,7 @@
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
(
!
TZ_isGlobalHideStatusBar
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
NO
;
}
}
}
}
...
@@ -449,7 +450,7 @@
...
@@ -449,7 +450,7 @@
_selectedAssets
=
selectedAssets
;
_selectedAssets
=
selectedAssets
;
_selectedModels
=
[
NSMutableArray
array
];
_selectedModels
=
[
NSMutableArray
array
];
for
(
id
asset
in
selectedAssets
)
{
for
(
id
asset
in
selectedAssets
)
{
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypePhoto
];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
[[
TZImageManager
manager
]
getAssetType
:
asset
]
];
model
.
isSelected
=
YES
;
model
.
isSelected
=
YES
;
[
_selectedModels
addObject
:
model
];
[
_selectedModels
addObject
:
model
];
}
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
1fe6744e
...
@@ -431,6 +431,7 @@ static CGFloat itemMargin = 5;
...
@@ -431,6 +431,7 @@ static CGFloat itemMargin = 5;
}
}
// the cell dipaly photo or video / 展示照片或视频的cell
// the cell dipaly photo or video / 展示照片或视频的cell
TZAssetCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZAssetCell"
forIndexPath
:
indexPath
];
TZAssetCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZAssetCell"
forIndexPath
:
indexPath
];
cell
.
allowPickingMultipleVideo
=
tzImagePickerVc
.
allowPickingMultipleVideo
;
cell
.
photoDefImageName
=
tzImagePickerVc
.
photoDefImageName
;
cell
.
photoDefImageName
=
tzImagePickerVc
.
photoDefImageName
;
cell
.
photoSelImageName
=
tzImagePickerVc
.
photoSelImageName
;
cell
.
photoSelImageName
=
tzImagePickerVc
.
photoSelImageName
;
TZAssetModel
*
model
;
TZAssetModel
*
model
;
...
@@ -492,7 +493,7 @@ static CGFloat itemMargin = 5;
...
@@ -492,7 +493,7 @@ static CGFloat itemMargin = 5;
index
=
indexPath
.
row
-
1
;
index
=
indexPath
.
row
-
1
;
}
}
TZAssetModel
*
model
=
_models
[
index
];
TZAssetModel
*
model
=
_models
[
index
];
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
&&
!
tzImagePickerVc
.
allowPickingMultipleVideo
)
{
if
(
tzImagePickerVc
.
selectedModels
.
count
>
0
)
{
if
(
tzImagePickerVc
.
selectedModels
.
count
>
0
)
{
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
imagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Can not choose both video and photo"
]];
[
imagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Can not choose both video and photo"
]];
...
@@ -501,7 +502,7 @@ static CGFloat itemMargin = 5;
...
@@ -501,7 +502,7 @@ static CGFloat itemMargin = 5;
videoPlayerVc
.
model
=
model
;
videoPlayerVc
.
model
=
model
;
[
self
.
navigationController
pushViewController
:
videoPlayerVc
animated
:
YES
];
[
self
.
navigationController
pushViewController
:
videoPlayerVc
animated
:
YES
];
}
}
}
else
if
(
model
.
type
==
TZAssetModelMediaTypePhotoGif
&&
tzImagePickerVc
.
allowPickingGif
)
{
}
else
if
(
model
.
type
==
TZAssetModelMediaTypePhotoGif
&&
tzImagePickerVc
.
allowPickingGif
&&
!
tzImagePickerVc
.
allowPickingMultipleVideo
)
{
if
(
tzImagePickerVc
.
selectedModels
.
count
>
0
)
{
if
(
tzImagePickerVc
.
selectedModels
.
count
>
0
)
{
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
imagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Can not choose both photo and GIF"
]];
[
imagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Can not choose both photo and GIF"
]];
...
@@ -633,16 +634,21 @@ static CGFloat itemMargin = 5;
...
@@ -633,16 +634,21 @@ static CGFloat itemMargin = 5;
-
(
void
)
scrollCollectionViewToBottom
{
-
(
void
)
scrollCollectionViewToBottom
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
_shouldScrollToBottom
&&
_models
.
count
>
0
&&
tzImagePickerVc
.
sortAscendingByModificationDate
)
{
if
(
_shouldScrollToBottom
&&
_models
.
count
>
0
)
{
NSInteger
item
=
_models
.
count
-
1
;
NSInteger
item
=
0
;
if
(
_showTakePhotoBtn
)
{
if
(
tzImagePickerVc
.
sortAscendingByModificationDate
)
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
item
=
_models
.
count
-
1
;
if
(
tzImagePickerVc
.
allowPickingImage
&&
tzImagePickerVc
.
allowTakePicture
)
{
if
(
_showTakePhotoBtn
)
{
item
+=
1
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
tzImagePickerVc
.
allowPickingImage
&&
tzImagePickerVc
.
allowTakePicture
)
{
item
+=
1
;
}
}
}
}
}
[
_collectionView
scrollToItemAtIndexPath
:[
NSIndexPath
indexPathForItem
:
item
inSection
:
0
]
atScrollPosition
:
UICollectionViewScrollPositionBottom
animated
:
NO
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
01
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
_shouldScrollToBottom
=
NO
;
[
_collectionView
scrollToItemAtIndexPath
:[
NSIndexPath
indexPathForItem
:
item
inSection
:
0
]
atScrollPosition
:
UICollectionViewScrollPositionBottom
animated
:
NO
];
_shouldScrollToBottom
=
NO
;
});
}
}
}
}
...
@@ -720,7 +726,7 @@ static CGFloat itemMargin = 5;
...
@@ -720,7 +726,7 @@ static CGFloat itemMargin = 5;
TZPhotoPreviewController
*
photoPreviewVc
=
[[
TZPhotoPreviewController
alloc
]
init
];
TZPhotoPreviewController
*
photoPreviewVc
=
[[
TZPhotoPreviewController
alloc
]
init
];
if
(
tzImagePickerVc
.
sortAscendingByModificationDate
)
{
if
(
tzImagePickerVc
.
sortAscendingByModificationDate
)
{
photoPreviewVc
.
currentIndex
=
_models
.
count
-
1
;
photoPreviewVc
.
currentIndex
=
_models
.
count
-
1
;
}
else
{
}
else
{
photoPreviewVc
.
currentIndex
=
0
;
photoPreviewVc
.
currentIndex
=
0
;
}
}
photoPreviewVc
.
models
=
_models
;
photoPreviewVc
.
models
=
_models
;
...
@@ -870,7 +876,7 @@ static CGFloat itemMargin = 5;
...
@@ -870,7 +876,7 @@ static CGFloat itemMargin = 5;
@implementation
TZCollectionView
@implementation
TZCollectionView
-
(
BOOL
)
touchesShouldCancelInContentView
:(
UIView
*
)
view
{
-
(
BOOL
)
touchesShouldCancelInContentView
:(
UIView
*
)
view
{
if
(
[
view
isKindOfClass
:[
UIControl
class
]])
{
if
([
view
isKindOfClass
:[
UIControl
class
]])
{
return
YES
;
return
YES
;
}
}
return
[
super
touchesShouldCancelInContentView
:
view
];
return
[
super
touchesShouldCancelInContentView
:
view
];
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.h
View file @
1fe6744e
...
@@ -8,11 +8,18 @@
...
@@ -8,11 +8,18 @@
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
@class
TZAssetModel
,
TZProgressView
,
TZPhotoPreviewView
;
@class
TZAssetModel
;
@
interface
TZPhotoPreviewCell
:
UICollectionViewCell
@interface
TZAssetPreviewCell
:
UICollectionViewCell
@property
(
nonatomic
,
strong
)
TZAssetModel
*
model
;
@property
(
nonatomic
,
strong
)
TZAssetModel
*
model
;
@property
(
nonatomic
,
copy
)
void
(
^
singleTapGestureBlock
)();
@property
(
nonatomic
,
copy
)
void
(
^
singleTapGestureBlock
)();
-
(
void
)
configSubviews
;
-
(
void
)
photoPreviewCollectionViewDidScroll
;
@end
@class
TZAssetModel
,
TZProgressView
,
TZPhotoPreviewView
;
@
interface
TZPhotoPreviewCell
:
TZAssetPreviewCell
@property
(
nonatomic
,
copy
)
void
(
^
imageProgressUpdateBlock
)(
double
progress
);
@property
(
nonatomic
,
copy
)
void
(
^
imageProgressUpdateBlock
)(
double
progress
);
@property
(
nonatomic
,
strong
)
TZPhotoPreviewView
*
previewView
;
@property
(
nonatomic
,
strong
)
TZPhotoPreviewView
*
previewView
;
...
@@ -43,3 +50,18 @@
...
@@ -43,3 +50,18 @@
-
(
void
)
recoverSubviews
;
-
(
void
)
recoverSubviews
;
@end
@end
@class
AVPlayer
,
AVPlayerLayer
;
@
interface
TZVideoPreviewCell
:
TZAssetPreviewCell
@property
(
strong
,
nonatomic
)
AVPlayer
*
player
;
@property
(
strong
,
nonatomic
)
AVPlayerLayer
*
playerLayer
;
@property
(
strong
,
nonatomic
)
UIButton
*
playButton
;
@property
(
strong
,
nonatomic
)
UIImage
*
cover
;
-
(
void
)
pausePlayerAndShowNaviBar
;
@end
@interface
TZGifPreviewCell
:
TZAssetPreviewCell
@property
(
strong
,
nonatomic
)
TZPhotoPreviewView
*
previewView
;
@end
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
View file @
1fe6744e
...
@@ -12,35 +12,58 @@
...
@@ -12,35 +12,58 @@
#import "TZImageManager.h"
#import "TZImageManager.h"
#import "TZProgressView.h"
#import "TZProgressView.h"
#import "TZImageCropManager.h"
#import "TZImageCropManager.h"
#import <MediaPlayer/MediaPlayer.h>
#import "TZImagePickerController.h"
@interface
TZPhotoPreviewCell
()
@implementation
TZAssetPreviewCell
@end
@implementation
TZPhotoPreviewCell
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
if
(
self
)
{
self
.
backgroundColor
=
[
UIColor
blackColor
];
self
.
backgroundColor
=
[
UIColor
blackColor
];
self
.
previewView
=
[[
TZPhotoPreviewView
alloc
]
initWithFrame
:
CGRectZero
];
[
self
configSubviews
];
__weak
typeof
(
self
)
weakSelf
=
self
;
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
photoPreviewCollectionViewDidScroll
)
name
:
@"photoPreviewCollectionViewDidScroll"
object
:
nil
];
[
self
.
previewView
setSingleTapGestureBlock
:
^
{
if
(
weakSelf
.
singleTapGestureBlock
)
{
weakSelf
.
singleTapGestureBlock
();
}
}];
[
self
.
previewView
setImageProgressUpdateBlock
:
^
(
double
progress
)
{
if
(
weakSelf
.
imageProgressUpdateBlock
)
{
weakSelf
.
imageProgressUpdateBlock
(
progress
);
}
}];
[
self
addSubview
:
self
.
previewView
];
}
}
return
self
;
return
self
;
}
}
-
(
void
)
configSubviews
{
}
#pragma mark - Notification
-
(
void
)
photoPreviewCollectionViewDidScroll
{
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
@end
@implementation
TZPhotoPreviewCell
-
(
void
)
configSubviews
{
self
.
previewView
=
[[
TZPhotoPreviewView
alloc
]
initWithFrame
:
CGRectZero
];
__weak
typeof
(
self
)
weakSelf
=
self
;
[
self
.
previewView
setSingleTapGestureBlock
:
^
{
if
(
weakSelf
.
singleTapGestureBlock
)
{
weakSelf
.
singleTapGestureBlock
();
}
}];
[
self
.
previewView
setImageProgressUpdateBlock
:
^
(
double
progress
)
{
if
(
weakSelf
.
imageProgressUpdateBlock
)
{
weakSelf
.
imageProgressUpdateBlock
(
progress
);
}
}];
[
self
addSubview
:
self
.
previewView
];
}
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
_model
=
model
;
[
super
setModel
:
model
]
;
_previewView
.
asset
=
model
.
asset
;
_previewView
.
asset
=
model
.
asset
;
}
}
...
@@ -297,3 +320,128 @@
...
@@ -297,3 +320,128 @@
}
}
@end
@end
@implementation
TZVideoPreviewCell
-
(
void
)
configSubviews
{
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
pausePlayerAndShowNaviBar
)
name
:
UIApplicationWillResignActiveNotification
object
:
nil
];
}
-
(
void
)
configPlayButton
{
if
(
_playButton
)
{
[
_playButton
removeFromSuperview
];
}
_playButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
_playButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
@"MMVideoPreviewPlay.png"
]
forState
:
UIControlStateNormal
];
[
_playButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
@"MMVideoPreviewPlayHL.png"
]
forState
:
UIControlStateHighlighted
];
[
_playButton
addTarget
:
self
action
:
@selector
(
playButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
addSubview
:
_playButton
];
}
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
[
super
setModel
:
model
];
[
self
configMoviePlayer
];
}
-
(
void
)
configMoviePlayer
{
if
(
_player
)
{
[
_playerLayer
removeFromSuperlayer
];
_playerLayer
=
nil
;
[
_player
pause
];
_player
=
nil
;
}
[[
TZImageManager
manager
]
getPhotoWithAsset
:
self
.
model
.
asset
completion
:
^
(
UIImage
*
photo
,
NSDictionary
*
info
,
BOOL
isDegraded
)
{
_cover
=
photo
;
}];
[[
TZImageManager
manager
]
getVideoWithAsset
:
self
.
model
.
asset
completion
:
^
(
AVPlayerItem
*
playerItem
,
NSDictionary
*
info
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
_player
=
[
AVPlayer
playerWithPlayerItem
:
playerItem
];
_playerLayer
=
[
AVPlayerLayer
playerLayerWithPlayer
:
_player
];
_playerLayer
.
backgroundColor
=
[
UIColor
blackColor
].
CGColor
;
_playerLayer
.
frame
=
self
.
bounds
;
[
self
.
layer
addSublayer
:
_playerLayer
];
[
self
configPlayButton
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
pausePlayerAndShowNaviBar
)
name
:
AVPlayerItemDidPlayToEndTimeNotification
object
:
_player
.
currentItem
];
});
}];
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
_playerLayer
.
frame
=
self
.
bounds
;
_playButton
.
frame
=
CGRectMake
(
0
,
64
,
self
.
tz_width
,
self
.
tz_height
-
64
-
44
);
}
-
(
void
)
photoPreviewCollectionViewDidScroll
{
[
self
pausePlayerAndShowNaviBar
];
}
#pragma mark - Click Event
-
(
void
)
playButtonClick
{
CMTime
currentTime
=
_player
.
currentItem
.
currentTime
;
CMTime
durationTime
=
_player
.
currentItem
.
duration
;
if
(
_player
.
rate
==
0
.
0
f
)
{
if
(
currentTime
.
value
==
durationTime
.
value
)
[
_player
.
currentItem
seekToTime
:
CMTimeMake
(
0
,
1
)];
[
_player
play
];
[
_playButton
setImage
:
nil
forState
:
UIControlStateNormal
];
if
(
!
TZ_isGlobalHideStatusBar
&&
iOS7Later
)
{
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
}
if
(
self
.
singleTapGestureBlock
)
{
self
.
singleTapGestureBlock
();
}
}
else
{
[
self
pausePlayerAndShowNaviBar
];
}
}
-
(
void
)
pausePlayerAndShowNaviBar
{
if
(
_player
.
rate
!=
0
.
0
)
{
[
_player
pause
];
[
_playButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
@"MMVideoPreviewPlay.png"
]
forState
:
UIControlStateNormal
];
if
(
self
.
singleTapGestureBlock
)
{
self
.
singleTapGestureBlock
();
}
}
}
@end
@implementation
TZGifPreviewCell
-
(
void
)
configSubviews
{
[
self
configPreviewView
];
}
-
(
void
)
configPreviewView
{
_previewView
=
[[
TZPhotoPreviewView
alloc
]
initWithFrame
:
CGRectZero
];
__weak
typeof
(
self
)
weakSelf
=
self
;
[
_previewView
setSingleTapGestureBlock
:
^
{
[
weakSelf
signleTapAction
];
}];
[
self
addSubview
:
_previewView
];
}
-
(
void
)
setModel
:(
TZAssetModel
*
)
model
{
[
super
setModel
:
model
];
_previewView
.
model
=
self
.
model
;
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
_previewView
.
frame
=
self
.
bounds
;
}
#pragma mark - Click Event
-
(
void
)
signleTapAction
{
if
(
self
.
singleTapGestureBlock
)
{
self
.
singleTapGestureBlock
();
}
}
@end
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
1fe6744e
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
-
(
void
)
configCustomNaviBar
{
-
(
void
)
configCustomNaviBar
{
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
_naviBar
=
[[
UIView
alloc
]
initWithFrame
:
CGRectZero
];
_naviBar
=
[[
UIView
alloc
]
initWithFrame
:
CGRectZero
];
_naviBar
.
backgroundColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
0
.
7
];
_naviBar
.
backgroundColor
=
[
UIColor
colorWithRed
:(
34
/
255
.
0
)
green
:(
34
/
255
.
0
)
blue
:
(
34
/
255
.
0
)
alpha
:
0
.
7
];
...
@@ -154,7 +154,7 @@
...
@@ -154,7 +154,7 @@
_numberLabel
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberLabel
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberLabel
.
hidden
=
_tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLabel
.
hidden
=
_tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLabel
.
backgroundColor
=
[
UIColor
clearColor
];
_numberLabel
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLabel
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLabel
];
[
_toolBar
addSubview
:
_doneButton
];
[
_toolBar
addSubview
:
_doneButton
];
[
_toolBar
addSubview
:
_originalPhotoButton
];
[
_toolBar
addSubview
:
_originalPhotoButton
];
...
@@ -177,6 +177,8 @@
...
@@ -177,6 +177,8 @@
_collectionView
.
contentSize
=
CGSizeMake
(
self
.
models
.
count
*
(
self
.
view
.
tz_width
+
20
),
0
);
_collectionView
.
contentSize
=
CGSizeMake
(
self
.
models
.
count
*
(
self
.
view
.
tz_width
+
20
),
0
);
[
self
.
view
addSubview
:
_collectionView
];
[
self
.
view
addSubview
:
_collectionView
];
[
_collectionView
registerClass
:[
TZPhotoPreviewCell
class
]
forCellWithReuseIdentifier
:
@"TZPhotoPreviewCell"
];
[
_collectionView
registerClass
:[
TZPhotoPreviewCell
class
]
forCellWithReuseIdentifier
:
@"TZPhotoPreviewCell"
];
[
_collectionView
registerClass
:[
TZVideoPreviewCell
class
]
forCellWithReuseIdentifier
:
@"TZVideoPreviewCell"
];
[
_collectionView
registerClass
:[
TZGifPreviewCell
class
]
forCellWithReuseIdentifier
:
@"TZGifPreviewCell"
];
}
}
-
(
void
)
configCropView
{
-
(
void
)
configCropView
{
...
@@ -213,6 +215,7 @@
...
@@ -213,6 +215,7 @@
-
(
void
)
viewDidLayoutSubviews
{
-
(
void
)
viewDidLayoutSubviews
{
[
super
viewDidLayoutSubviews
];
[
super
viewDidLayoutSubviews
];
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
_naviBar
.
frame
=
CGRectMake
(
0
,
0
,
self
.
view
.
tz_width
,
64
);
_naviBar
.
frame
=
CGRectMake
(
0
,
0
,
self
.
view
.
tz_width
,
64
);
_backButton
.
frame
=
CGRectMake
(
10
,
10
,
44
,
44
);
_backButton
.
frame
=
CGRectMake
(
10
,
10
,
44
,
44
);
...
@@ -227,10 +230,11 @@
...
@@ -227,10 +230,11 @@
CGFloat
offsetX
=
_offsetItemCount
*
_layout
.
itemSize
.
width
;
CGFloat
offsetX
=
_offsetItemCount
*
_layout
.
itemSize
.
width
;
[
_collectionView
setContentOffset
:
CGPointMake
(
offsetX
,
0
)];
[
_collectionView
setContentOffset
:
CGPointMake
(
offsetX
,
0
)];
}
}
[
_collectionView
reloadData
];
if
(
_tzImagePickerVc
.
allowCrop
)
{
[
_collectionView
reloadData
];
}
_toolBar
.
frame
=
CGRectMake
(
0
,
self
.
view
.
tz_height
-
44
,
self
.
view
.
tz_width
,
44
);
_toolBar
.
frame
=
CGRectMake
(
0
,
self
.
view
.
tz_height
-
44
,
self
.
view
.
tz_width
,
44
);
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
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
);
...
@@ -260,14 +264,14 @@
...
@@ -260,14 +264,14 @@
NSString
*
title
=
[
NSString
stringWithFormat
:[
NSBundle
tz_localizedStringForKey
:
@"Select a maximum of %zd photos"
],
_tzImagePickerVc
.
maxImagesCount
];
NSString
*
title
=
[
NSString
stringWithFormat
:[
NSBundle
tz_localizedStringForKey
:
@"Select a maximum of %zd photos"
],
_tzImagePickerVc
.
maxImagesCount
];
[
_tzImagePickerVc
showAlertWithTitle
:
title
];
[
_tzImagePickerVc
showAlertWithTitle
:
title
];
return
;
return
;
// 2. if not over the maxImagesCount / 如果没有超过最大个数限制
// 2. if not over the maxImagesCount / 如果没有超过最大个数限制
}
else
{
}
else
{
[
_tzImagePickerVc
.
selectedModels
addObject
:
model
];
[
_tzImagePickerVc
.
selectedModels
addObject
:
model
];
if
(
self
.
photos
)
{
if
(
self
.
photos
)
{
[
_tzImagePickerVc
.
selectedAssets
addObject
:
_assetsTemp
[
_currentIndex
]];
[
_tzImagePickerVc
.
selectedAssets
addObject
:
_assetsTemp
[
_currentIndex
]];
[
self
.
photos
addObject
:
_photosTemp
[
_currentIndex
]];
[
self
.
photos
addObject
:
_photosTemp
[
_currentIndex
]];
}
}
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
&&
!
_tzImagePickerVc
.
allowPickingMultipleVideo
)
{
[
_tzImagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Select the video when in multi state, we will handle the video as a photo"
]];
[
_tzImagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Select the video when in multi state, we will handle the video as a photo"
]];
}
}
}
}
...
@@ -328,7 +332,7 @@
...
@@ -328,7 +332,7 @@
_alertView
=
[
_tzImagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Synchronizing photos from iCloud"
]];
_alertView
=
[
_tzImagePickerVc
showAlertWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Synchronizing photos from iCloud"
]];
return
;
return
;
}
}
// 如果没有选中过照片 点击确定时选中当前预览的照片
// 如果没有选中过照片 点击确定时选中当前预览的照片
if
(
_tzImagePickerVc
.
selectedModels
.
count
==
0
&&
_tzImagePickerVc
.
minImagesCount
<=
0
)
{
if
(
_tzImagePickerVc
.
selectedModels
.
count
==
0
&&
_tzImagePickerVc
.
minImagesCount
<=
0
)
{
TZAssetModel
*
model
=
_models
[
_currentIndex
];
TZAssetModel
*
model
=
_models
[
_currentIndex
];
...
@@ -369,6 +373,12 @@
...
@@ -369,6 +373,12 @@
}
}
}
}
-
(
void
)
didTapPreviewCell
{
self
.
isHideNaviBar
=
!
self
.
isHideNaviBar
;
_naviBar
.
hidden
=
self
.
isHideNaviBar
;
_toolBar
.
hidden
=
self
.
isHideNaviBar
;
}
#pragma mark - UIScrollViewDelegate
#pragma mark - UIScrollViewDelegate
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
...
@@ -381,6 +391,8 @@
...
@@ -381,6 +391,8 @@
_currentIndex
=
currentIndex
;
_currentIndex
=
currentIndex
;
[
self
refreshNaviBarAndBottomBarState
];
[
self
refreshNaviBarAndBottomBarState
];
}
}
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"photoPreviewCollectionViewDidScroll"
object
:
nil
];
}
}
#pragma mark - UICollectionViewDataSource && Delegate
#pragma mark - UICollectionViewDataSource && Delegate
...
@@ -390,34 +402,38 @@
...
@@ -390,34 +402,38 @@
}
}
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TZPhotoPreviewCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZPhotoPreviewCell"
forIndexPath
:
indexPath
];
cell
.
model
=
_models
[
indexPath
.
row
];
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
cell
.
cropRect
=
_tzImagePickerVc
.
cropRect
;
TZAssetModel
*
model
=
_models
[
indexPath
.
row
];
cell
.
allowCrop
=
_tzImagePickerVc
.
allowCrop
;
TZAssetPreviewCell
*
cell
;
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
self
)
weakSelf
=
self
;
if
(
!
cell
.
singleTapGestureBlock
)
{
if
(
_tzImagePickerVc
.
allowPickingMultipleVideo
&&
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
__weak
typeof
(
_naviBar
)
weakNaviBar
=
_naviBar
;
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZVideoPreviewCell"
forIndexPath
:
indexPath
]
;
__weak
typeof
(
_toolBar
)
weakToolBar
=
_toolBar
;
}
else
if
(
_tzImagePickerVc
.
allowPickingMultipleVideo
&&
model
.
type
==
TZAssetModelMediaTypePhotoGif
&&
_tzImagePickerVc
.
allowPickingGif
)
{
cell
.
singleTapGestureBlock
=
^
(){
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZGifPreviewCell"
forIndexPath
:
indexPath
];
// show or hide naviBar / 显示或隐藏导航栏
}
else
{
weakSelf
.
isHideNaviBar
=
!
weakSelf
.
isHideNaviBar
;
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZPhotoPreviewCell"
forIndexPath
:
indexPath
]
;
weakNaviBar
.
hidden
=
weakSelf
.
isHideNaviBar
;
TZPhotoPreviewCell
*
photoPreviewCell
=
(
TZPhotoPreviewCell
*
)
cell
;
weakToolBar
.
hidden
=
weakSelf
.
isHideNaviBar
;
photoPreviewCell
.
cropRect
=
_tzImagePickerVc
.
cropRect
;
}
;
photoPreviewCell
.
allowCrop
=
_tzImagePickerVc
.
allowCrop
;
}
__weak
typeof
(
_tzImagePickerVc
)
weakTzImagePickerVc
=
_tzImagePickerVc
;
__weak
typeof
(
_tzImagePickerVc
)
weakTzImagePickerVc
=
_tzImagePickerVc
;
__weak
typeof
(
_collectionView
)
weakCollectionView
=
_collectionView
;
__weak
typeof
(
_collectionView
)
weakCollectionView
=
_collectionView
;
__weak
typeof
(
photoPreviewCell
)
weakCell
=
photoPreviewCell
;
__weak
typeof
(
cell
)
weakCell
=
cell
;
[
photoPreviewCell
setImageProgressUpdateBlock
:
^
(
double
progress
)
{
[
cell
setImageProgressUpdateBlock
:
^
(
double
progress
)
{
weakSelf
.
progress
=
progress
;
weakSelf
.
progress
=
progress
;
if
(
progress
>=
1
)
{
if
(
progress
>=
1
)
{
if
(
weakSelf
.
alertView
&&
[
weakCollectionView
.
visibleCells
containsObject
:
weakCell
]
)
{
if
(
weakSelf
.
alertView
&&
[
weakCollectionView
.
visibleCells
containsObject
:
weakCell
])
{
[
weakTzImagePickerVc
hideAlertView
:
weakSelf
.
alertView
];
[
weakTzImagePickerVc
hideAlertView
:
weakSelf
.
alertView
]
;
weakSelf
.
alertView
=
nil
;
weakSelf
.
alertView
=
nil
;
[
weakSelf
doneButtonClick
]
;
[
weakSelf
doneButtonClick
];
}
}
}
}
}];
}
cell
.
model
=
model
;
[
cell
setSingleTapGestureBlock
:
^
{
[
weakSelf
didTapPreviewCell
];
}];
}];
return
cell
;
return
cell
;
}
}
...
@@ -431,6 +447,8 @@
...
@@ -431,6 +447,8 @@
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didEndDisplayingCell
:(
UICollectionViewCell
*
)
cell
forItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didEndDisplayingCell
:(
UICollectionViewCell
*
)
cell
forItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
([
cell
isKindOfClass
:[
TZPhotoPreviewCell
class
]])
{
if
([
cell
isKindOfClass
:[
TZPhotoPreviewCell
class
]])
{
[(
TZPhotoPreviewCell
*
)
cell
recoverSubviews
];
[(
TZPhotoPreviewCell
*
)
cell
recoverSubviews
];
}
else
if
([
cell
isKindOfClass
:[
TZVideoPreviewCell
class
]])
{
[(
TZVideoPreviewCell
*
)
cell
pausePlayerAndShowNaviBar
];
}
}
}
}
...
...
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
View file @
1fe6744e
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
self
.
navigationItem
.
title
=
tzImagePickerVc
.
previewBtnTitleStr
;
self
.
navigationItem
.
title
=
tzImagePickerVc
.
previewBtnTitleStr
;
}
}
[
self
configMoviePlayer
];
[
self
configMoviePlayer
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
pausePlayerAndShowNaviBar
)
name
:
UIApplicationWillResignActiveNotification
object
:
nil
];
}
}
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
...
...
TZImagePickerController/TZTestCell.m
View file @
1fe6744e
...
@@ -32,7 +32,6 @@
...
@@ -32,7 +32,6 @@
_deleteBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_deleteBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
_deleteBtn
setImage
:[
UIImage
imageNamed
:
@"photo_delete"
]
forState
:
UIControlStateNormal
];
[
_deleteBtn
setImage
:[
UIImage
imageNamed
:
@"photo_delete"
]
forState
:
UIControlStateNormal
];
_deleteBtn
.
frame
=
CGRectMake
(
self
.
tz_width
-
36
,
0
,
36
,
36
);
_deleteBtn
.
imageEdgeInsets
=
UIEdgeInsetsMake
(
-
10
,
0
,
0
,
-
10
);
_deleteBtn
.
imageEdgeInsets
=
UIEdgeInsetsMake
(
-
10
,
0
,
0
,
-
10
);
_deleteBtn
.
alpha
=
0
.
6
;
_deleteBtn
.
alpha
=
0
.
6
;
[
self
addSubview
:
_deleteBtn
];
[
self
addSubview
:
_deleteBtn
];
...
@@ -43,7 +42,6 @@
...
@@ -43,7 +42,6 @@
_gifLable
.
backgroundColor
=
[
UIColor
colorWithRed
:
0
green
:
0
blue
:
0
alpha
:
0
.
8
];
_gifLable
.
backgroundColor
=
[
UIColor
colorWithRed
:
0
green
:
0
blue
:
0
alpha
:
0
.
8
];
_gifLable
.
textAlignment
=
NSTextAlignmentCenter
;
_gifLable
.
textAlignment
=
NSTextAlignmentCenter
;
_gifLable
.
font
=
[
UIFont
systemFontOfSize
:
10
];
_gifLable
.
font
=
[
UIFont
systemFontOfSize
:
10
];
_gifLable
.
frame
=
CGRectMake
(
self
.
tz_width
-
25
,
self
.
tz_height
-
14
,
25
,
14
);
[
self
addSubview
:
_gifLable
];
[
self
addSubview
:
_gifLable
];
}
}
return
self
;
return
self
;
...
@@ -52,6 +50,8 @@
...
@@ -52,6 +50,8 @@
-
(
void
)
layoutSubviews
{
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
[
super
layoutSubviews
];
_imageView
.
frame
=
self
.
bounds
;
_imageView
.
frame
=
self
.
bounds
;
_gifLable
.
frame
=
CGRectMake
(
self
.
tz_width
-
25
,
self
.
tz_height
-
14
,
25
,
14
);
_deleteBtn
.
frame
=
CGRectMake
(
self
.
tz_width
-
36
,
0
,
36
,
36
);
CGFloat
width
=
self
.
tz_width
/
3
.
0
;
CGFloat
width
=
self
.
tz_width
/
3
.
0
;
_videoImageView
.
frame
=
CGRectMake
(
width
,
width
,
width
,
width
);
_videoImageView
.
frame
=
CGRectMake
(
width
,
width
,
width
,
width
);
}
}
...
...
TZImagePickerController/ViewController.m
View file @
1fe6744e
...
@@ -29,8 +29,11 @@
...
@@ -29,8 +29,11 @@
}
}
@property
(
nonatomic
,
strong
)
UIImagePickerController
*
imagePickerVc
;
@property
(
nonatomic
,
strong
)
UIImagePickerController
*
imagePickerVc
;
@property
(
nonatomic
,
strong
)
UICollectionView
*
collectionView
;
@property
(
nonatomic
,
strong
)
UICollectionView
*
collectionView
;
@property
(
strong
,
nonatomic
)
LxGridViewFlowLayout
*
layout
;
@property
(
strong
,
nonatomic
)
CLLocation
*
location
;
@property
(
strong
,
nonatomic
)
CLLocation
*
location
;
// 6个设置开关
@property
(
weak
,
nonatomic
)
IBOutlet
UIScrollView
*
scrollView
;
// 设置开关
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
showTakePhotoBtnSwitch
;
///< 在内部显示拍照按钮
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
showTakePhotoBtnSwitch
;
///< 在内部显示拍照按钮
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
sortAscendingSwitch
;
///< 照片排列按修改时间升序
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
sortAscendingSwitch
;
///< 照片排列按修改时间升序
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
allowPickingVideoSwitch
;
///< 允许选择视频
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
allowPickingVideoSwitch
;
///< 允许选择视频
...
@@ -42,6 +45,7 @@
...
@@ -42,6 +45,7 @@
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
columnNumberTF
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
columnNumberTF
;
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
allowCropSwitch
;
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
allowCropSwitch
;
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
needCircleCropSwitch
;
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
needCircleCropSwitch
;
@property
(
weak
,
nonatomic
)
IBOutlet
UISwitch
*
allowPickingMuitlpleVideoSwitch
;
@end
@end
@implementation
ViewController
@implementation
ViewController
...
@@ -83,13 +87,8 @@
...
@@ -83,13 +87,8 @@
-
(
void
)
configCollectionView
{
-
(
void
)
configCollectionView
{
// 如不需要长按排序效果,将LxGridViewFlowLayout类改成UICollectionViewFlowLayout即可
// 如不需要长按排序效果,将LxGridViewFlowLayout类改成UICollectionViewFlowLayout即可
LxGridViewFlowLayout
*
layout
=
[[
LxGridViewFlowLayout
alloc
]
init
];
_layout
=
[[
LxGridViewFlowLayout
alloc
]
init
];
_margin
=
4
;
_collectionView
=
[[
UICollectionView
alloc
]
initWithFrame
:
CGRectZero
collectionViewLayout
:
_layout
];
_itemWH
=
(
self
.
view
.
tz_width
-
2
*
_margin
-
4
)
/
3
-
_margin
;
layout
.
itemSize
=
CGSizeMake
(
_itemWH
,
_itemWH
);
layout
.
minimumInteritemSpacing
=
_margin
;
layout
.
minimumLineSpacing
=
_margin
;
_collectionView
=
[[
UICollectionView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
409
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
-
409
)
collectionViewLayout
:
layout
];
CGFloat
rgb
=
244
/
255
.
0
;
CGFloat
rgb
=
244
/
255
.
0
;
_collectionView
.
alwaysBounceVertical
=
YES
;
_collectionView
.
alwaysBounceVertical
=
YES
;
_collectionView
.
backgroundColor
=
[
UIColor
colorWithRed
:
rgb
green
:
rgb
blue
:
rgb
alpha
:
1
.
0
];
_collectionView
.
backgroundColor
=
[
UIColor
colorWithRed
:
rgb
green
:
rgb
blue
:
rgb
alpha
:
1
.
0
];
...
@@ -101,6 +100,22 @@
...
@@ -101,6 +100,22 @@
[
_collectionView
registerClass
:[
TZTestCell
class
]
forCellWithReuseIdentifier
:
@"TZTestCell"
];
[
_collectionView
registerClass
:[
TZTestCell
class
]
forCellWithReuseIdentifier
:
@"TZTestCell"
];
}
}
-
(
void
)
viewDidLayoutSubviews
{
[
super
viewDidLayoutSubviews
];
NSInteger
contentSizeH
=
12
*
35
+
20
;
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
0
.
01
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
self
.
scrollView
.
contentSize
=
CGSizeMake
(
0
,
contentSizeH
+
5
);
});
_margin
=
4
;
_itemWH
=
(
self
.
view
.
tz_width
-
2
*
_margin
-
4
)
/
3
-
_margin
;
_layout
.
itemSize
=
CGSizeMake
(
_itemWH
,
_itemWH
);
_layout
.
minimumInteritemSpacing
=
_margin
;
_layout
.
minimumLineSpacing
=
_margin
;
[
self
.
collectionView
setCollectionViewLayout
:
_layout
];
self
.
collectionView
.
frame
=
CGRectMake
(
0
,
contentSizeH
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
-
contentSizeH
);
}
#pragma mark UICollectionView
#pragma mark UICollectionView
-
(
NSInteger
)
collectionView
:(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:(
NSInteger
)
section
{
-
(
NSInteger
)
collectionView
:(
UICollectionView
*
)
collectionView
numberOfItemsInSection
:(
NSInteger
)
section
{
...
@@ -146,12 +161,12 @@
...
@@ -146,12 +161,12 @@
ALAsset
*
alAsset
=
asset
;
ALAsset
*
alAsset
=
asset
;
isVideo
=
[[
alAsset
valueForProperty
:
ALAssetPropertyType
]
isEqualToString
:
ALAssetTypeVideo
];
isVideo
=
[[
alAsset
valueForProperty
:
ALAssetPropertyType
]
isEqualToString
:
ALAssetTypeVideo
];
}
}
if
([[
asset
valueForKey
:
@"filename"
]
containsString
:
@"GIF"
]
&&
self
.
allowPickingGifSwitch
.
isOn
)
{
if
([[
asset
valueForKey
:
@"filename"
]
containsString
:
@"GIF"
]
&&
self
.
allowPickingGifSwitch
.
isOn
&&
!
self
.
allowPickingMuitlpleVideoSwitch
.
isOn
)
{
TZGifPhotoPreviewController
*
vc
=
[[
TZGifPhotoPreviewController
alloc
]
init
];
TZGifPhotoPreviewController
*
vc
=
[[
TZGifPhotoPreviewController
alloc
]
init
];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypePhotoGif
timeLength
:
@""
];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypePhotoGif
timeLength
:
@""
];
vc
.
model
=
model
;
vc
.
model
=
model
;
[
self
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
[
self
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
}
else
if
(
isVideo
)
{
// perview video / 预览视频
}
else
if
(
isVideo
&&
!
self
.
allowPickingMuitlpleVideoSwitch
.
isOn
)
{
// perview video / 预览视频
TZVideoPlayerController
*
vc
=
[[
TZVideoPlayerController
alloc
]
init
];
TZVideoPlayerController
*
vc
=
[[
TZVideoPlayerController
alloc
]
init
];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypeVideo
timeLength
:
@""
];
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypeVideo
timeLength
:
@""
];
vc
.
model
=
model
;
vc
.
model
=
model
;
...
@@ -159,7 +174,9 @@
...
@@ -159,7 +174,9 @@
}
else
{
// preview photos / 预览照片
}
else
{
// preview photos / 预览照片
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithSelectedAssets
:
_selectedAssets
selectedPhotos
:
_selectedPhotos
index
:
indexPath
.
row
];
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithSelectedAssets
:
_selectedAssets
selectedPhotos
:
_selectedPhotos
index
:
indexPath
.
row
];
imagePickerVc
.
maxImagesCount
=
self
.
maxCountTF
.
text
.
integerValue
;
imagePickerVc
.
maxImagesCount
=
self
.
maxCountTF
.
text
.
integerValue
;
imagePickerVc
.
allowPickingGif
=
self
.
allowPickingGifSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
imagePickerVc
.
allowPickingMultipleVideo
=
self
.
allowPickingMuitlpleVideoSwitch
.
isOn
;
imagePickerVc
.
isSelectOriginalPhoto
=
_isSelectOriginalPhoto
;
imagePickerVc
.
isSelectOriginalPhoto
=
_isSelectOriginalPhoto
;
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
_selectedPhotos
=
[
NSMutableArray
arrayWithArray
:
photos
];
_selectedPhotos
=
[
NSMutableArray
arrayWithArray
:
photos
];
...
@@ -229,6 +246,7 @@
...
@@ -229,6 +246,7 @@
imagePickerVc
.
allowPickingImage
=
self
.
allowPickingImageSwitch
.
isOn
;
imagePickerVc
.
allowPickingImage
=
self
.
allowPickingImageSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
imagePickerVc
.
allowPickingGif
=
self
.
allowPickingGifSwitch
.
isOn
;
imagePickerVc
.
allowPickingGif
=
self
.
allowPickingGifSwitch
.
isOn
;
imagePickerVc
.
allowPickingMultipleVideo
=
self
.
allowPickingMuitlpleVideoSwitch
.
isOn
;
// 是否可以多选视频
// 4. 照片排列按修改时间升序
// 4. 照片排列按修改时间升序
imagePickerVc
.
sortAscendingByModificationDate
=
self
.
sortAscendingSwitch
.
isOn
;
imagePickerVc
.
sortAscendingByModificationDate
=
self
.
sortAscendingSwitch
.
isOn
;
...
@@ -578,12 +596,17 @@
...
@@ -578,12 +596,17 @@
-
(
IBAction
)
allowPickingGifSwitchClick
:(
UISwitch
*
)
sender
{
-
(
IBAction
)
allowPickingGifSwitchClick
:(
UISwitch
*
)
sender
{
if
(
sender
.
isOn
)
{
if
(
sender
.
isOn
)
{
[
_allowPickingImageSwitch
setOn
:
YES
animated
:
YES
];
[
_allowPickingImageSwitch
setOn
:
YES
animated
:
YES
];
}
else
if
(
!
self
.
allowPickingVideoSwitch
.
isOn
)
{
[
self
.
allowPickingMuitlpleVideoSwitch
setOn
:
NO
animated
:
YES
];
}
}
}
}
-
(
IBAction
)
allowPickingVideoSwitchClick
:(
UISwitch
*
)
sender
{
-
(
IBAction
)
allowPickingVideoSwitchClick
:(
UISwitch
*
)
sender
{
if
(
!
sender
.
isOn
)
{
if
(
!
sender
.
isOn
)
{
[
_allowPickingImageSwitch
setOn
:
YES
animated
:
YES
];
[
_allowPickingImageSwitch
setOn
:
YES
animated
:
YES
];
if
(
!
self
.
allowPickingGifSwitch
.
isOn
)
{
[
self
.
allowPickingMuitlpleVideoSwitch
setOn
:
NO
animated
:
YES
];
}
}
}
}
}
...
@@ -592,6 +615,9 @@
...
@@ -592,6 +615,9 @@
self
.
maxCountTF
.
text
=
@"1"
;
self
.
maxCountTF
.
text
=
@"1"
;
[
self
.
allowPickingOriginalPhotoSwitch
setOn
:
NO
animated
:
YES
];
[
self
.
allowPickingOriginalPhotoSwitch
setOn
:
NO
animated
:
YES
];
}
else
{
}
else
{
if
([
self
.
maxCountTF
.
text
isEqualToString
:
@"1"
])
{
self
.
maxCountTF
.
text
=
@"9"
;
}
[
self
.
needCircleCropSwitch
setOn
:
NO
animated
:
YES
];
[
self
.
needCircleCropSwitch
setOn
:
NO
animated
:
YES
];
}
}
}
}
...
@@ -604,6 +630,10 @@
...
@@ -604,6 +630,10 @@
}
}
}
}
-
(
IBAction
)
allowPickingMultipleVideoSwitchClick
:(
UISwitch
*
)
sender
{
}
-
(
void
)
touchesBegan
:(
NSSet
<
UITouch
*>
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
-
(
void
)
touchesBegan
:(
NSSet
<
UITouch
*>
*
)
touches
withEvent
:(
UIEvent
*
)
event
{
[
self
.
view
endEditing
:
YES
];
[
self
.
view
endEditing
:
YES
];
}
}
...
@@ -621,14 +651,10 @@
...
@@ -621,14 +651,10 @@
ALAsset
*
alAsset
=
(
ALAsset
*
)
asset
;
ALAsset
*
alAsset
=
(
ALAsset
*
)
asset
;
fileName
=
alAsset
.
defaultRepresentation
.
filename
;;
fileName
=
alAsset
.
defaultRepresentation
.
filename
;;
}
}
//NSLog(@"图片名字:%@",fileName);
//
NSLog(@"图片名字:%@",fileName);
}
}
}
}
-
(
UIInterfaceOrientationMask
)
supportedInterfaceOrientations
{
return
UIInterfaceOrientationMaskPortrait
;
}
#pragma clang diagnostic pop
#pragma clang diagnostic pop
@end
@end
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