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
a567b512
Commit
a567b512
authored
Apr 24, 2016
by
tanzhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入拍照功能;优化显示效果,可全局显示已选中的图片,切换相册亦可,设置selectedAssets即可显示上次已选中的图片。
parent
55864229
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
418 additions
and
130 deletions
+418
-130
TZImagePickerController/TZImagePickerController/TZAssetCell.h
...agePickerController/TZImagePickerController/TZAssetCell.h
+9
-1
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+46
-1
TZImagePickerController/TZImagePickerController/TZAssetModel.h
...gePickerController/TZImagePickerController/TZAssetModel.h
+3
-0
TZImagePickerController/TZImagePickerController/TZAssetModel.m
...gePickerController/TZImagePickerController/TZAssetModel.m
+32
-0
TZImagePickerController/TZImagePickerController/TZImageManager.m
...PickerController/TZImagePickerController/TZImageManager.m
+0
-2
TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/takePicture@2x.png
...troller/TZImagePickerController.bundle/takePicture@2x.png
+0
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+24
-9
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+63
-18
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.h
...troller/TZImagePickerController/TZPhotoPickerController.h
+1
-0
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+205
-62
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.h
...roller/TZImagePickerController/TZPhotoPreviewController.h
+3
-3
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+27
-31
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+5
-3
No files found.
TZImagePickerController/TZImagePickerController/TZAssetCell.h
View file @
a567b512
...
@@ -18,7 +18,7 @@ typedef enum : NSUInteger {
...
@@ -18,7 +18,7 @@ typedef enum : NSUInteger {
@class
TZAssetModel
;
@class
TZAssetModel
;
@interface
TZAssetCell
:
UICollectionViewCell
@interface
TZAssetCell
:
UICollectionViewCell
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
selectPhotoButton
;
@property
(
weak
,
nonatomic
)
UIButton
*
selectPhotoButton
;
@property
(
nonatomic
,
strong
)
TZAssetModel
*
model
;
@property
(
nonatomic
,
strong
)
TZAssetModel
*
model
;
@property
(
nonatomic
,
copy
)
void
(
^
didSelectPhotoBlock
)(
BOOL
);
@property
(
nonatomic
,
copy
)
void
(
^
didSelectPhotoBlock
)(
BOOL
);
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
@property
(
nonatomic
,
assign
)
TZAssetCellType
type
;
...
@@ -31,5 +31,13 @@ typedef enum : NSUInteger {
...
@@ -31,5 +31,13 @@ typedef enum : NSUInteger {
@interface
TZAlbumCell
:
UITableViewCell
@interface
TZAlbumCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
TZAlbumModel
*
model
;
@property
(
nonatomic
,
strong
)
TZAlbumModel
*
model
;
@property
(
weak
,
nonatomic
)
UIButton
*
selectedCountButton
;
@end
@end
@interface
TZAssetCameraCell
:
UICollectionViewCell
@property
(
nonatomic
,
strong
)
UIImageView
*
imageView
;
@end
\ No newline at end of file
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
a567b512
...
@@ -169,11 +169,18 @@
...
@@ -169,11 +169,18 @@
[[
TZImageManager
manager
]
getPostImageWithAlbumModel
:
model
completion
:
^
(
UIImage
*
postImage
)
{
[[
TZImageManager
manager
]
getPostImageWithAlbumModel
:
model
completion
:
^
(
UIImage
*
postImage
)
{
self
.
posterImageView
.
image
=
postImage
;
self
.
posterImageView
.
image
=
postImage
;
}];
}];
if
(
model
.
selectedCount
)
{
self
.
selectedCountButton
.
hidden
=
NO
;
[
self
.
selectedCountButton
setTitle
:[
NSString
stringWithFormat
:
@"%zd"
,
model
.
selectedCount
]
forState
:
UIControlStateNormal
];
}
else
{
self
.
selectedCountButton
.
hidden
=
YES
;
}
}
}
/// For fitting iOS6
/// For fitting iOS6
-
(
void
)
layoutSubviews
{
-
(
void
)
layoutSubviews
{
if
(
iOS7Later
)
[
super
layoutSubviews
];
if
(
iOS7Later
)
[
super
layoutSubviews
];
_selectedCountButton
.
frame
=
CGRectMake
(
self
.
tz_width
-
24
-
30
,
23
,
24
,
24
);
}
}
-
(
void
)
layoutSublayersOfLayer
:(
CALayer
*
)
layer
{
-
(
void
)
layoutSublayersOfLayer
:(
CALayer
*
)
layer
{
...
@@ -219,4 +226,42 @@
...
@@ -219,4 +226,42 @@
return
_arrowImageView
;
return
_arrowImageView
;
}
}
@end
-
(
UIButton
*
)
selectedCountButton
{
\ No newline at end of file
if
(
_selectedCountButton
==
nil
)
{
UIButton
*
selectedCountButton
=
[[
UIButton
alloc
]
init
];
selectedCountButton
.
layer
.
cornerRadius
=
12
;
selectedCountButton
.
clipsToBounds
=
YES
;
selectedCountButton
.
backgroundColor
=
[
UIColor
redColor
];
[
selectedCountButton
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
selectedCountButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
];
[
self
.
contentView
addSubview
:
selectedCountButton
];
_selectedCountButton
=
selectedCountButton
;
}
return
_selectedCountButton
;
}
@end
@implementation
TZAssetCameraCell
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
backgroundColor
=
[
UIColor
whiteColor
];
_imageView
=
[[
UIImageView
alloc
]
init
];
_imageView
.
backgroundColor
=
[
UIColor
colorWithWhite
:
1
.
000
alpha
:
0
.
500
];
_imageView
.
contentMode
=
UIViewContentModeScaleAspectFill
;
[
self
addSubview
:
_imageView
];
self
.
clipsToBounds
=
YES
;
}
return
self
;
}
-
(
void
)
layoutSubviews
{
[
super
layoutSubviews
];
_imageView
.
frame
=
self
.
bounds
;
}
@end
TZImagePickerController/TZImagePickerController/TZAssetModel.h
View file @
a567b512
...
@@ -39,4 +39,7 @@ typedef enum : NSUInteger {
...
@@ -39,4 +39,7 @@ typedef enum : NSUInteger {
@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
)
id
result
;
///< PHFetchResult<PHAsset> or ALAssetsGroup<ALAsset>
@property
(
nonatomic
,
strong
)
NSArray
*
models
;
@property
(
nonatomic
,
strong
)
NSArray
*
selectedModels
;
@property
(
nonatomic
,
assign
)
NSUInteger
selectedCount
;
@end
@end
\ No newline at end of file
TZImagePickerController/TZImagePickerController/TZAssetModel.m
View file @
a567b512
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
//
//
#import "TZAssetModel.h"
#import "TZAssetModel.h"
#import "TZImageManager.h"
@implementation
TZAssetModel
@implementation
TZAssetModel
...
@@ -30,5 +31,36 @@
...
@@ -30,5 +31,36 @@
@implementation
TZAlbumModel
@implementation
TZAlbumModel
-
(
void
)
setResult
:(
id
)
result
{
_result
=
result
;
BOOL
allowPickingImage
=
[[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"tz_allowPickingImage"
]
isEqualToString
:
@"1"
];
BOOL
allowPickingVideo
=
[[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"tz_allowPickingVideo"
]
isEqualToString
:
@"1"
];
[[
TZImageManager
manager
]
getAssetsFromFetchResult
:
result
allowPickingVideo
:
allowPickingVideo
allowPickingImage
:
allowPickingImage
completion
:^
(
NSArray
<
TZAssetModel
*>
*
models
)
{
_models
=
models
;
if
(
_selectedModels
)
{
[
self
checkSelectedModels
];
}
}];
}
-
(
void
)
setSelectedModels
:(
NSArray
*
)
selectedModels
{
_selectedModels
=
selectedModels
;
if
(
_models
)
{
[
self
checkSelectedModels
];
}
}
-
(
void
)
checkSelectedModels
{
self
.
selectedCount
=
0
;
NSMutableArray
*
selectedAssets
=
[
NSMutableArray
array
];
for
(
TZAssetModel
*
model
in
_selectedModels
)
{
[
selectedAssets
addObject
:
model
.
asset
];
}
for
(
TZAssetModel
*
model
in
_models
)
{
if
([
selectedAssets
containsObject
:
model
.
asset
])
{
self
.
selectedCount
++
;
}
}
}
@end
@end
\ No newline at end of file
TZImagePickerController/TZImagePickerController/TZImageManager.m
View file @
a567b512
...
@@ -54,8 +54,6 @@
...
@@ -54,8 +54,6 @@
PHAssetMediaTypeVideo
];
PHAssetMediaTypeVideo
];
option
.
sortDescriptors
=
@[[
NSSortDescriptor
sortDescriptorWithKey
:
@"creationDate"
ascending
:
YES
]];
option
.
sortDescriptors
=
@[[
NSSortDescriptor
sortDescriptorWithKey
:
@"creationDate"
ascending
:
YES
]];
PHFetchResult
*
smartAlbums
=
[
PHAssetCollection
fetchAssetCollectionsWithType
:
PHAssetCollectionTypeSmartAlbum
subtype
:
PHAssetCollectionSubtypeSmartAlbumUserLibrary
options
:
nil
];
PHFetchResult
*
smartAlbums
=
[
PHAssetCollection
fetchAssetCollectionsWithType
:
PHAssetCollectionTypeSmartAlbum
subtype
:
PHAssetCollectionSubtypeSmartAlbumUserLibrary
options
:
nil
];
for
(
PHAssetCollection
*
collection
in
smartAlbums
)
{
for
(
PHAssetCollection
*
collection
in
smartAlbums
)
{
if
([
collection
.
localizedTitle
isEqualToString
:
@"Camera Roll"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"相机胶卷"
])
{
if
([
collection
.
localizedTitle
isEqualToString
:
@"Camera Roll"
]
||
[
collection
.
localizedTitle
isEqualToString
:
@"相机胶卷"
])
{
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/takePicture@2x.png
0 → 100644
View file @
a567b512
5.79 KB
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
a567b512
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
*/
*/
#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import "TZAssetModel.h"
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS7Later ([UIDevice currentDevice].systemVersion.floatValue >= 7.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)
...
@@ -50,20 +51,30 @@
...
@@ -50,20 +51,30 @@
/// 默认为YES,如果设置为NO,用户将不能选择发送图片
/// 默认为YES,如果设置为NO,用户将不能选择发送图片
@property
(
nonatomic
,
assign
)
BOOL
allowPickingImage
;
@property
(
nonatomic
,
assign
)
BOOL
allowPickingImage
;
/// The photos user have selected
/// 用户选中过的图片数组
@property
(
nonatomic
,
strong
)
NSArray
*
selectedAssets
;
@property
(
nonatomic
,
strong
)
NSMutableArray
<
TZAssetModel
*>
*
selectedModels
;
-
(
void
)
showAlertWithTitle
:(
NSString
*
)
title
;
-
(
void
)
showAlertWithTitle
:(
NSString
*
)
title
;
-
(
void
)
showProgressHUD
;
-
(
void
)
showProgressHUD
;
-
(
void
)
hideProgressHUD
;
-
(
void
)
hideProgressHUD
;
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
/// Appearance / 外观颜色
/// Appearance / 外观颜色
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorNormal
;
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorNormal
;
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorDisabled
;
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorDisabled
;
// The picker should dismiss itself; when it dismissed these handle will be called.
// The picker should dismiss itself; when it dismissed these handle will be called.
// The second array will be a empty array if user not picking original photo.
// If isOriginalPhoto is YES, user picked the original photo.
// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
// The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的handle
// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的handle
// 如果用户没有选择发送原图,第二个数组将是空数组
// 如果isSelectOriginalPhoto为YES,表明用户选择了原图
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingPhotosHandle
)(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
);
// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingPhotosWithInfosHandle
)(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
NSArray
<
NSDictionary
*>
*
infos
);
// photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingPhotosHandle
)(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
);
@property
(
nonatomic
,
copy
)
void
(
^
didFinishPickingPhotosWithInfosHandle
)(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
,
NSArray
<
NSDictionary
*>
*
infos
);
@property
(
nonatomic
,
copy
)
void
(
^
imagePickerControllerDidCancelHandle
)();
@property
(
nonatomic
,
copy
)
void
(
^
imagePickerControllerDidCancelHandle
)();
// 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.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
...
@@ -79,11 +90,15 @@
...
@@ -79,11 +90,15 @@
@protocol
TZImagePickerControllerDelegate
<
NSObject
>
@protocol
TZImagePickerControllerDelegate
<
NSObject
>
@optional
@optional
// The picker should dismiss itself; when it dismissed these handle will be called.
// The picker should dismiss itself; when it dismissed these handle will be called.
// Assets will be a empty array if user not picking original photo.
// If isOriginalPhoto is YES, user picked the original photo.
// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的回调
// You can get original photo with asset, by the method [[TZImageManager manager] getOriginalPhotoWithAsset:completion:].
// 如果用户没有选择发送原图,Assets将是空数组
// The UIImage Object in photos default width is 828px, you can set it by photoWidth property.
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
<
UIImage
*>
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
;
// 这个照片选择器会自己dismiss,当选择器dismiss的时候,会执行下面的handle
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
<
UIImage
*>
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
infos
:(
NSArray
<
NSDictionary
*>
*
)
infos
;
// 如果isSelectOriginalPhoto为YES,表明用户选择了原图
// 你可以通过一个asset获得原图,通过这个方法:[[TZImageManager manager] getOriginalPhotoWithAsset:completion:]
// photos数组里的UIImage对象,默认是828像素宽,你可以通过设置photoWidth属性的值来改变它
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
<
UIImage
*>
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
isSelectOriginalPhoto
:(
BOOL
)
isSelectOriginalPhoto
;
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
<
UIImage
*>
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
isSelectOriginalPhoto
:(
BOOL
)
isSelectOriginalPhoto
infos
:(
NSArray
<
NSDictionary
*>
*
)
infos
;
-
(
void
)
imagePickerControllerDidCancel
:(
TZImagePickerController
*
)
picker
;
-
(
void
)
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.
// If system version > iOS8,asset is kind of PHAsset class, else is ALAsset class.
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
a567b512
...
@@ -78,13 +78,15 @@
...
@@ -78,13 +78,15 @@
if
(
self
)
{
if
(
self
)
{
self
.
maxImagesCount
=
maxImagesCount
>
0
?
maxImagesCount
:
9
;
// Default is 9 / 默认最大可选9张图片
self
.
maxImagesCount
=
maxImagesCount
>
0
?
maxImagesCount
:
9
;
// Default is 9 / 默认最大可选9张图片
self
.
pickerDelegate
=
delegate
;
self
.
pickerDelegate
=
delegate
;
self
.
selectedModels
=
[
NSMutableArray
array
];
// Allow user picking original photo and video, you also can set No after this method
// Allow user picking original photo and video, you also can set No after this method
// 默认准许用户选择原图和视频, 你也可以在这个方法后置为NO
// 默认准许用户选择原图和视频, 你也可以在这个方法后置为NO
_
allowPickingOriginalPhoto
=
YES
;
self
.
allowPickingOriginalPhoto
=
YES
;
_
allowPickingVideo
=
YES
;
self
.
allowPickingVideo
=
YES
;
_
allowPickingImage
=
YES
;
self
.
allowPickingImage
=
YES
;
_
timeout
=
15
;
self
.
timeout
=
15
;
_
photoWidth
=
828
.
0
;
self
.
photoWidth
=
828
.
0
;
if
(
!
[[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
if
(
!
[[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
_tipLable
=
[[
UILabel
alloc
]
init
];
_tipLable
=
[[
UILabel
alloc
]
init
];
...
@@ -188,6 +190,30 @@
...
@@ -188,6 +190,30 @@
}
}
}
}
-
(
void
)
setSelectedAssets
:(
NSArray
*
)
selectedAssets
{
_selectedAssets
=
selectedAssets
;
_selectedModels
=
[
NSMutableArray
array
];
for
(
id
asset
in
selectedAssets
)
{
TZAssetModel
*
model
=
[
TZAssetModel
modelWithAsset
:
asset
type
:
TZAssetModelMediaTypePhoto
];
model
.
isSelected
=
YES
;
[
_selectedModels
addObject
:
model
];
}
}
-
(
void
)
setAllowPickingImage
:(
BOOL
)
allowPickingImage
{
_allowPickingImage
=
allowPickingImage
;
NSString
*
allowPickingImageStr
=
_allowPickingImage
?
@"1"
:
@"0"
;
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
allowPickingImageStr
forKey
:
@"tz_allowPickingImage"
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
}
-
(
void
)
setAllowPickingVideo
:(
BOOL
)
allowPickingVideo
{
_allowPickingVideo
=
allowPickingVideo
;
NSString
*
allowPickingVideoStr
=
_allowPickingVideo
?
@"1"
:
@"0"
;
[[
NSUserDefaults
standardUserDefaults
]
setObject
:
allowPickingVideoStr
forKey
:
@"tz_allowPickingVideo"
];
[[
NSUserDefaults
standardUserDefaults
]
synchronize
];
}
-
(
void
)
pushViewController
:(
UIViewController
*
)
viewController
animated
:(
BOOL
)
animated
{
-
(
void
)
pushViewController
:(
UIViewController
*
)
viewController
animated
:(
BOOL
)
animated
{
if
(
iOS7Later
)
viewController
.
automaticallyAdjustsScrollViewInsets
=
NO
;
if
(
iOS7Later
)
viewController
.
automaticallyAdjustsScrollViewInsets
=
NO
;
if
(
_timer
)
{
[
_timer
invalidate
];
_timer
=
nil
;}
if
(
_timer
)
{
[
_timer
invalidate
];
_timer
=
nil
;}
...
@@ -228,24 +254,36 @@
...
@@ -228,24 +254,36 @@
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
imagePickerVc
hideProgressHUD
];
[
imagePickerVc
hideProgressHUD
];
if
(
_albumArr
)
return
;
if
(
_albumArr
)
{
[
self
configTableView
];
for
(
TZAlbumModel
*
albumModel
in
_albumArr
)
{
albumModel
.
selectedModels
=
imagePickerVc
.
selectedModels
;
}
[
_tableView
reloadData
];
}
else
{
[
self
configTableView
];
}
}
}
-
(
void
)
configTableView
{
-
(
void
)
configTableView
{
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[[
TZImageManager
manager
]
getAllAlbums
:
imagePickerVc
.
allowPickingVideo
allowPickingImage
:
imagePickerVc
.
allowPickingImage
completion
:^
(
NSArray
<
TZAlbumModel
*>
*
models
)
{
[[
TZImageManager
manager
]
getAllAlbums
:
imagePickerVc
.
allowPickingVideo
allowPickingImage
:
imagePickerVc
.
allowPickingImage
completion
:^
(
NSArray
<
TZAlbumModel
*>
*
models
)
{
_albumArr
=
[
NSMutableArray
arrayWithArray
:
models
];
_albumArr
=
[
NSMutableArray
arrayWithArray
:
models
];
for
(
TZAlbumModel
*
albumModel
in
_albumArr
)
{
CGFloat
top
=
44
;
albumModel
.
selectedModels
=
imagePickerVc
.
selectedModels
;
if
(
iOS7Later
)
top
+=
20
;
}
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
top
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
-
top
)
style
:
UITableViewStylePlain
];
if
(
!
_tableView
)
{
_tableView
.
rowHeight
=
70
;
CGFloat
top
=
44
;
_tableView
.
tableFooterView
=
[[
UIView
alloc
]
init
];
if
(
iOS7Later
)
top
+=
20
;
_tableView
.
dataSource
=
self
;
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
top
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
-
top
)
style
:
UITableViewStylePlain
];
_tableView
.
delegate
=
self
;
_tableView
.
rowHeight
=
70
;
[
_tableView
registerClass
:[
TZAlbumCell
class
]
forCellReuseIdentifier
:
@"TZAlbumCell"
];
_tableView
.
tableFooterView
=
[[
UIView
alloc
]
init
];
[
self
.
view
addSubview
:
_tableView
];
_tableView
.
dataSource
=
self
;
_tableView
.
delegate
=
self
;
[
_tableView
registerClass
:[
TZAlbumCell
class
]
forCellReuseIdentifier
:
@"TZAlbumCell"
];
[
self
.
view
addSubview
:
_tableView
];
}
else
{
[
_tableView
reloadData
];
}
}];
}];
}
}
...
@@ -270,13 +308,20 @@
...
@@ -270,13 +308,20 @@
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TZAlbumCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"TZAlbumCell"
];
TZAlbumCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"TZAlbumCell"
];
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
cell
.
selectedCountButton
.
backgroundColor
=
imagePickerVc
.
oKButtonTitleColorNormal
;
cell
.
model
=
_albumArr
[
indexPath
.
row
];
cell
.
model
=
_albumArr
[
indexPath
.
row
];
cell
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
return
cell
;
return
cell
;
}
}
-
(
void
)
tableView
:(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
void
)
tableView
:(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TZPhotoPickerController
*
photoPickerVc
=
[[
TZPhotoPickerController
alloc
]
init
];
TZPhotoPickerController
*
photoPickerVc
=
[[
TZPhotoPickerController
alloc
]
init
];
photoPickerVc
.
model
=
_albumArr
[
indexPath
.
row
];
TZAlbumModel
*
model
=
_albumArr
[
indexPath
.
row
];
photoPickerVc
.
model
=
model
;
[
photoPickerVc
setBackButtonClickHandle
:
^
(
TZAlbumModel
*
model
)
{
[
_albumArr
replaceObjectAtIndex
:
indexPath
.
row
withObject
:
model
];
}];
[
self
.
navigationController
pushViewController
:
photoPickerVc
animated
:
YES
];
[
self
.
navigationController
pushViewController
:
photoPickerVc
animated
:
YES
];
[
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
NO
];
[
tableView
deselectRowAtIndexPath
:
indexPath
animated
:
NO
];
}
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.h
View file @
a567b512
...
@@ -12,5 +12,6 @@
...
@@ -12,5 +12,6 @@
@interface
TZPhotoPickerController
:
UIViewController
@interface
TZPhotoPickerController
:
UIViewController
@property
(
nonatomic
,
strong
)
TZAlbumModel
*
model
;
@property
(
nonatomic
,
strong
)
TZAlbumModel
*
model
;
@property
(
nonatomic
,
copy
)
void
(
^
backButtonClickHandle
)(
TZAlbumModel
*
model
);
@end
@end
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
a567b512
This diff is collapsed.
Click to expand it.
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.h
View file @
a567b512
...
@@ -11,12 +11,12 @@
...
@@ -11,12 +11,12 @@
@interface
TZPhotoPreviewController
:
UIViewController
@interface
TZPhotoPreviewController
:
UIViewController
@property
(
nonatomic
,
strong
)
NSArray
*
photoArr
;
///< All photos / 所有图片的数组
@property
(
nonatomic
,
strong
)
NSArray
*
photoArr
;
///< All photos / 所有图片的数组
@property
(
nonatomic
,
strong
)
NSMutableArray
*
selectedPhotoArr
;
///< Current selected photos / 当前选中的图片数组
//
@property (nonatomic, strong) NSMutableArray *selectedPhotoArr; ///< Current selected photos / 当前选中的图片数组
@property
(
nonatomic
,
assign
)
NSInteger
currentIndex
;
///< Index of the photo user click / 用户点击的图片的索引
@property
(
nonatomic
,
assign
)
NSInteger
currentIndex
;
///< Index of the photo user click / 用户点击的图片的索引
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
///< If YES,return original photo / 是否返回原图
@property
(
nonatomic
,
assign
)
BOOL
isSelectOriginalPhoto
;
///< If YES,return original photo / 是否返回原图
/// Return the new selected photos / 返回最新的选中图片数组
/// Return the new selected photos / 返回最新的选中图片数组
@property
(
nonatomic
,
copy
)
void
(
^
returnNewSelectedPhotoArrBlock
)(
NSMutableArray
*
newSeletedPhotoArr
,
BOOL
isSelectOriginalPhoto
);
@property
(
nonatomic
,
copy
)
void
(
^
backButtonClickBlock
)(
BOOL
isSelectOriginalPhoto
);
@property
(
nonatomic
,
copy
)
void
(
^
okButtonClickBlock
)(
NSMutableArray
*
newSeletedPhotoArr
,
BOOL
isSelectOriginalPhoto
);
@property
(
nonatomic
,
copy
)
void
(
^
okButtonClickBlock
)(
BOOL
isSelectOriginalPhoto
);
@end
@end
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
a567b512
...
@@ -28,18 +28,15 @@
...
@@ -28,18 +28,15 @@
UIButton
*
_originalPhotoButton
;
UIButton
*
_originalPhotoButton
;
UILabel
*
_originalPhotoLable
;
UILabel
*
_originalPhotoLable
;
}
}
@property
(
nonatomic
,
strong
)
TZImagePickerController
*
tzImagePickerVc
;
@end
@end
@implementation
TZPhotoPreviewController
@implementation
TZPhotoPreviewController
-
(
NSMutableArray
*
)
selectedPhotoArr
{
if
(
_selectedPhotoArr
==
nil
)
_selectedPhotoArr
=
[[
NSMutableArray
alloc
]
init
];
return
_selectedPhotoArr
;
}
-
(
void
)
viewDidLoad
{
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
__weak
typeof
(
self
)
weakSelf
=
self
;
_tzImagePickerVc
=
(
TZImagePickerController
*
)
weakSelf
.
navigationController
;
[
self
configCollectionView
];
[
self
configCollectionView
];
[
self
configCustomNaviBar
];
[
self
configCustomNaviBar
];
[
self
configBottomToolBar
];
[
self
configBottomToolBar
];
...
@@ -85,8 +82,7 @@
...
@@ -85,8 +82,7 @@
_toolBar
.
backgroundColor
=
[
UIColor
colorWithRed
:
rgb
green
:
rgb
blue
:
rgb
alpha
:
1
.
0
];
_toolBar
.
backgroundColor
=
[
UIColor
colorWithRed
:
rgb
green
:
rgb
blue
:
rgb
alpha
:
1
.
0
];
_toolBar
.
alpha
=
0
.
7
;
_toolBar
.
alpha
=
0
.
7
;
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
if
(
imagePickerVc
.
allowPickingOriginalPhoto
)
{
_originalPhotoButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_originalPhotoButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_originalPhotoButton
.
frame
=
CGRectMake
(
5
,
0
,
120
,
44
);
_originalPhotoButton
.
frame
=
CGRectMake
(
5
,
0
,
120
,
44
);
_originalPhotoButton
.
imageEdgeInsets
=
UIEdgeInsetsMake
(
0
,
-
8
,
0
,
0
);
_originalPhotoButton
.
imageEdgeInsets
=
UIEdgeInsetsMake
(
0
,
-
8
,
0
,
0
);
...
@@ -115,20 +111,20 @@
...
@@ -115,20 +111,20 @@
_okButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_okButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
];
[
_okButton
addTarget
:
self
action
:
@selector
(
okButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_okButton
addTarget
:
self
action
:
@selector
(
okButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_okButton
setTitle
:
@"确定"
forState
:
UIControlStateNormal
];
[
_okButton
setTitle
:
@"确定"
forState
:
UIControlStateNormal
];
[
_okButton
setTitleColor
:
i
magePickerVc
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
[
_okButton
setTitleColor
:
_tzI
magePickerVc
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
_numberImageView
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamedFromMyBundle
:
@"photo_number_icon.png"
]];
_numberImageView
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamedFromMyBundle
:
@"photo_number_icon.png"
]];
_numberImageView
.
backgroundColor
=
[
UIColor
clearColor
];
_numberImageView
.
backgroundColor
=
[
UIColor
clearColor
];
_numberImageView
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
56
-
24
,
9
,
26
,
26
);
_numberImageView
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
56
-
24
,
9
,
26
,
26
);
_numberImageView
.
hidden
=
_
selectedPhotoArr
.
count
<=
0
;
_numberImageView
.
hidden
=
_
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLable
=
[[
UILabel
alloc
]
init
];
_numberLable
=
[[
UILabel
alloc
]
init
];
_numberLable
.
frame
=
_numberImageView
.
frame
;
_numberLable
.
frame
=
_numberImageView
.
frame
;
_numberLable
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_numberLable
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_numberLable
.
textColor
=
[
UIColor
whiteColor
];
_numberLable
.
textColor
=
[
UIColor
whiteColor
];
_numberLable
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLable
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLable
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_
selectedPhotoArr
.
count
];
_numberLable
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_
tzImagePickerVc
.
selectedModels
.
count
];
_numberLable
.
hidden
=
_
selectedPhotoArr
.
count
<=
0
;
_numberLable
.
hidden
=
_
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLable
.
backgroundColor
=
[
UIColor
clearColor
];
_numberLable
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLable
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLable
];
...
@@ -164,20 +160,23 @@
...
@@ -164,20 +160,23 @@
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
if
(
!
selectButton
.
isSelected
)
{
if
(
!
selectButton
.
isSelected
)
{
// 1. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
// 1. select:check if over the maxImagesCount / 选择照片,检查是否超过了最大个数的限制
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
_tzImagePickerVc
.
selectedModels
.
count
>=
_tzImagePickerVc
.
maxImagesCount
)
{
if
(
self
.
selectedPhotoArr
.
count
>=
imagePickerVc
.
maxImagesCount
)
{
[
_tzImagePickerVc
showAlertWithTitle
:[
NSString
stringWithFormat
:
@"你最多只能选择%zd张照片"
,
_tzImagePickerVc
.
maxImagesCount
]];
[
imagePickerVc
showAlertWithTitle
:[
NSString
stringWithFormat
:
@"你最多只能选择%zd张照片"
,
imagePickerVc
.
maxImagesCount
]];
return
;
return
;
// 2. if not over the maxImagesCount / 如果没有超过最大个数限制
// 2. if not over the maxImagesCount / 如果没有超过最大个数限制
}
else
{
}
else
{
[
self
.
selectedPhotoArr
addObject
:
model
];
[
_tzImagePickerVc
.
selectedModels
addObject
:
model
];
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
_tzImagePickerVc
showAlertWithTitle
:
@"多选状态下选择视频,默认将视频当图片发送"
];
[
imagePickerVc
showAlertWithTitle
:
@"多选状态下选择视频,默认将视频当图片发送"
];
}
}
}
}
}
else
{
}
else
{
[
self
.
selectedPhotoArr
removeObject
:
model
];
NSArray
*
selectedModels
=
[
NSArray
arrayWithArray
:
self
.
tzImagePickerVc
.
selectedModels
];
for
(
TZAssetModel
*
model_item
in
selectedModels
)
{
if
([
model
.
asset
isEqual
:
model_item
.
asset
])
{
[
self
.
tzImagePickerVc
.
selectedModels
removeObject
:
model_item
];
}
}
}
}
model
.
isSelected
=
!
selectButton
.
isSelected
;
model
.
isSelected
=
!
selectButton
.
isSelected
;
[
self
refreshNaviBarAndBottomBarState
];
[
self
refreshNaviBarAndBottomBarState
];
...
@@ -189,18 +188,18 @@
...
@@ -189,18 +188,18 @@
-
(
void
)
back
{
-
(
void
)
back
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
if
(
self
.
returnNewSelectedPhotoArr
Block
)
{
if
(
self
.
backButtonClick
Block
)
{
self
.
returnNewSelectedPhotoArrBlock
(
self
.
selectedPhotoArr
,
_isSelectOriginalPhoto
);
self
.
backButtonClickBlock
(
_isSelectOriginalPhoto
);
}
}
}
}
-
(
void
)
okButtonClick
{
-
(
void
)
okButtonClick
{
if
(
_
selectedPhotoArr
.
count
==
0
)
{
if
(
_
tzImagePickerVc
.
selectedModels
.
count
==
0
)
{
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
[
_
selectedPhotoArr
addObject
:
model
];
[
_
tzImagePickerVc
.
selectedModels
addObject
:
model
];
}
}
if
(
self
.
okButtonClickBlock
)
{
if
(
self
.
okButtonClickBlock
)
{
self
.
okButtonClickBlock
(
self
.
selectedPhotoArr
,
_isSelectOriginalPhoto
);
self
.
okButtonClickBlock
(
_isSelectOriginalPhoto
);
}
}
}
}
...
@@ -218,10 +217,7 @@
...
@@ -218,10 +217,7 @@
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
CGPoint
offSet
=
scrollView
.
contentOffset
;
CGPoint
offSet
=
scrollView
.
contentOffset
;
_currentIndex
=
offSet
.
x
/
self
.
view
.
tz_width
;
_currentIndex
=
(
offSet
.
x
+
(
self
.
view
.
tz_width
*
0
.
5
))
/
self
.
view
.
tz_width
;
}
-
(
void
)
scrollViewDidEndDecelerating
:(
UIScrollView
*
)
scrollView
{
[
self
refreshNaviBarAndBottomBarState
];
[
self
refreshNaviBarAndBottomBarState
];
}
}
...
@@ -254,9 +250,9 @@
...
@@ -254,9 +250,9 @@
-
(
void
)
refreshNaviBarAndBottomBarState
{
-
(
void
)
refreshNaviBarAndBottomBarState
{
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
TZAssetModel
*
model
=
_photoArr
[
_currentIndex
];
_selectButton
.
selected
=
model
.
isSelected
;
_selectButton
.
selected
=
model
.
isSelected
;
_numberLable
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_
selectedPhotoArr
.
count
];
_numberLable
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_
tzImagePickerVc
.
selectedModels
.
count
];
_numberImageView
.
hidden
=
(
_
selectedPhotoArr
.
count
<=
0
||
_isHideNaviBar
);
_numberImageView
.
hidden
=
(
_
tzImagePickerVc
.
selectedModels
.
count
<=
0
||
_isHideNaviBar
);
_numberLable
.
hidden
=
(
_
selectedPhotoArr
.
count
<=
0
||
_isHideNaviBar
);
_numberLable
.
hidden
=
(
_
tzImagePickerVc
.
selectedModels
.
count
<=
0
||
_isHideNaviBar
);
_originalPhotoButton
.
selected
=
_isSelectOriginalPhoto
;
_originalPhotoButton
.
selected
=
_isSelectOriginalPhoto
;
_originalPhotoLable
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
_originalPhotoLable
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
...
...
TZImagePickerController/ViewController.m
View file @
a567b512
...
@@ -73,10 +73,11 @@
...
@@ -73,10 +73,11 @@
-
(
IBAction
)
pickPhotoButtonClick
:(
UIButton
*
)
sender
{
-
(
IBAction
)
pickPhotoButtonClick
:(
UIButton
*
)
sender
{
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
9
delegate
:
self
];
TZImagePickerController
*
imagePickerVc
=
[[
TZImagePickerController
alloc
]
initWithMaxImagesCount
:
9
delegate
:
self
];
imagePickerVc
.
selectedAssets
=
_selectedAssets
;
// optional, 可选的
// You can get the photos by block, the same as by delegate.
// You can get the photos by block, the same as by delegate.
// 你可以通过block或者代理,来得到用户选择的照片.
// 你可以通过block或者代理,来得到用户选择的照片.
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
)
{
[
imagePickerVc
setDidFinishPickingPhotosHandle
:
^
(
NSArray
<
UIImage
*>
*
photos
,
NSArray
*
assets
,
BOOL
isSelectOriginalPhoto
)
{
}];
}];
...
@@ -105,8 +106,9 @@
...
@@ -105,8 +106,9 @@
/// User finish picking photo,if assets are not empty, user picking original photo.
/// User finish picking photo,if assets are not empty, user picking original photo.
/// 用户选择好了图片,如果assets非空,则用户选择了原图。
/// 用户选择好了图片,如果assets非空,则用户选择了原图。
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
{
-
(
void
)
imagePickerController
:(
TZImagePickerController
*
)
picker
didFinishPickingPhotos
:(
NSArray
*
)
photos
sourceAssets
:(
NSArray
*
)
assets
isSelectOriginalPhoto
:(
BOOL
)
isSelectOriginalPhoto
{
[
_selectedPhotos
addObjectsFromArray
:
photos
];
_selectedPhotos
=
[
NSMutableArray
arrayWithArray
:
photos
];
_selectedAssets
=
[
NSMutableArray
arrayWithArray
:
assets
];
[
_collectionView
reloadData
];
[
_collectionView
reloadData
];
_collectionView
.
contentSize
=
CGSizeMake
(
0
,
((
_selectedPhotos
.
count
+
2
)
/
3
)
*
(
_margin
+
_itemWH
));
_collectionView
.
contentSize
=
CGSizeMake
(
0
,
((
_selectedPhotos
.
count
+
2
)
/
3
)
*
(
_margin
+
_itemWH
));
}
}
...
...
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