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
2af9fb3e
Commit
2af9fb3e
authored
May 17, 2018
by
王向明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改CollectionView回调中的代码书写错误
parent
e1c9ec22
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+6
-6
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+1
-1
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+7
-7
No files found.
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
2af9fb3e
...
@@ -467,7 +467,7 @@ static CGFloat itemMargin = 5;
...
@@ -467,7 +467,7 @@ static CGFloat itemMargin = 5;
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
// the cell lead to take a picture / 去拍照的cell
// the cell lead to take a picture / 去拍照的cell
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(((
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
row
>=
_models
.
count
)
||
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
row
==
0
))
&&
_showTakePhotoBtn
)
{
if
(((
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
item
>=
_models
.
count
)
||
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
item
==
0
))
&&
_showTakePhotoBtn
)
{
TZAssetCameraCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZAssetCameraCell"
forIndexPath
:
indexPath
];
TZAssetCameraCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZAssetCameraCell"
forIndexPath
:
indexPath
];
cell
.
imageView
.
image
=
tzImagePickerVc
.
takePictureImage
;
cell
.
imageView
.
image
=
tzImagePickerVc
.
takePictureImage
;
if
([
tzImagePickerVc
.
takePictureImageName
isEqualToString
:
@"takePicture80"
])
{
if
([
tzImagePickerVc
.
takePictureImageName
isEqualToString
:
@"takePicture80"
])
{
...
@@ -487,9 +487,9 @@ static CGFloat itemMargin = 5;
...
@@ -487,9 +487,9 @@ static CGFloat itemMargin = 5;
cell
.
useCachedImage
=
self
.
useCachedImage
;
cell
.
useCachedImage
=
self
.
useCachedImage
;
TZAssetModel
*
model
;
TZAssetModel
*
model
;
if
(
tzImagePickerVc
.
sortAscendingByModificationDate
||
!
_showTakePhotoBtn
)
{
if
(
tzImagePickerVc
.
sortAscendingByModificationDate
||
!
_showTakePhotoBtn
)
{
model
=
_models
[
indexPath
.
row
];
model
=
_models
[
indexPath
.
item
];
}
else
{
}
else
{
model
=
_models
[
indexPath
.
row
-
1
];
model
=
_models
[
indexPath
.
item
-
1
];
}
}
cell
.
allowPickingGif
=
tzImagePickerVc
.
allowPickingGif
;
cell
.
allowPickingGif
=
tzImagePickerVc
.
allowPickingGif
;
cell
.
model
=
model
;
cell
.
model
=
model
;
...
@@ -555,13 +555,13 @@ static CGFloat itemMargin = 5;
...
@@ -555,13 +555,13 @@ static CGFloat itemMargin = 5;
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
// take a photo / 去拍照
// take a photo / 去拍照
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(((
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
row
>=
_models
.
count
)
||
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
row
==
0
))
&&
_showTakePhotoBtn
)
{
if
(((
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
item
>=
_models
.
count
)
||
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
indexPath
.
item
==
0
))
&&
_showTakePhotoBtn
)
{
[
self
takePhoto
];
return
;
[
self
takePhoto
];
return
;
}
}
// preview phote or video / 预览照片或视频
// preview phote or video / 预览照片或视频
NSInteger
index
=
indexPath
.
row
;
NSInteger
index
=
indexPath
.
item
;
if
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
_showTakePhotoBtn
)
{
if
(
!
tzImagePickerVc
.
sortAscendingByModificationDate
&&
_showTakePhotoBtn
)
{
index
=
indexPath
.
row
-
1
;
index
=
indexPath
.
item
-
1
;
}
}
TZAssetModel
*
model
=
_models
[
index
];
TZAssetModel
*
model
=
_models
[
index
];
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
&&
!
tzImagePickerVc
.
allowPickingMultipleVideo
)
{
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
&&
!
tzImagePickerVc
.
allowPickingMultipleVideo
)
{
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
2af9fb3e
...
@@ -431,7 +431,7 @@
...
@@ -431,7 +431,7 @@
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZAssetModel
*
model
=
_models
[
indexPath
.
row
];
TZAssetModel
*
model
=
_models
[
indexPath
.
item
];
TZAssetPreviewCell
*
cell
;
TZAssetPreviewCell
*
cell
;
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
self
)
weakSelf
=
self
;
...
...
TZImagePickerController/ViewController.m
View file @
2af9fb3e
...
@@ -131,25 +131,25 @@
...
@@ -131,25 +131,25 @@
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
UICollectionViewCell
*
)
collectionView
:(
UICollectionView
*
)
collectionView
cellForItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
TZTestCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZTestCell"
forIndexPath
:
indexPath
];
TZTestCell
*
cell
=
[
collectionView
dequeueReusableCellWithReuseIdentifier
:
@"TZTestCell"
forIndexPath
:
indexPath
];
cell
.
videoImageView
.
hidden
=
YES
;
cell
.
videoImageView
.
hidden
=
YES
;
if
(
indexPath
.
row
==
_selectedPhotos
.
count
)
{
if
(
indexPath
.
item
==
_selectedPhotos
.
count
)
{
cell
.
imageView
.
image
=
[
UIImage
imageNamed
:
@"AlbumAddBtn.png"
];
cell
.
imageView
.
image
=
[
UIImage
imageNamed
:
@"AlbumAddBtn.png"
];
cell
.
deleteBtn
.
hidden
=
YES
;
cell
.
deleteBtn
.
hidden
=
YES
;
cell
.
gifLable
.
hidden
=
YES
;
cell
.
gifLable
.
hidden
=
YES
;
}
else
{
}
else
{
cell
.
imageView
.
image
=
_selectedPhotos
[
indexPath
.
row
];
cell
.
imageView
.
image
=
_selectedPhotos
[
indexPath
.
item
];
cell
.
asset
=
_selectedAssets
[
indexPath
.
row
];
cell
.
asset
=
_selectedAssets
[
indexPath
.
item
];
cell
.
deleteBtn
.
hidden
=
NO
;
cell
.
deleteBtn
.
hidden
=
NO
;
}
}
if
(
!
self
.
allowPickingGifSwitch
.
isOn
)
{
if
(
!
self
.
allowPickingGifSwitch
.
isOn
)
{
cell
.
gifLable
.
hidden
=
YES
;
cell
.
gifLable
.
hidden
=
YES
;
}
}
cell
.
deleteBtn
.
tag
=
indexPath
.
row
;
cell
.
deleteBtn
.
tag
=
indexPath
.
item
;
[
cell
.
deleteBtn
addTarget
:
self
action
:
@selector
(
deleteBtnClik
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
cell
.
deleteBtn
addTarget
:
self
action
:
@selector
(
deleteBtnClik
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
return
cell
;
return
cell
;
}
}
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
didSelectItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
row
==
_selectedPhotos
.
count
)
{
if
(
indexPath
.
item
==
_selectedPhotos
.
count
)
{
BOOL
showSheet
=
self
.
showSheetSwitch
.
isOn
;
BOOL
showSheet
=
self
.
showSheetSwitch
.
isOn
;
if
(
showSheet
)
{
if
(
showSheet
)
{
UIActionSheet
*
sheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
@"拍照"
,
@"去相册选择"
,
nil
];
UIActionSheet
*
sheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
@"拍照"
,
@"去相册选择"
,
nil
];
...
@@ -158,7 +158,7 @@
...
@@ -158,7 +158,7 @@
[
self
pushTZImagePickerController
];
[
self
pushTZImagePickerController
];
}
}
}
else
{
// preview photos or video / 预览照片或者视频
}
else
{
// preview photos or video / 预览照片或者视频
id
asset
=
_selectedAssets
[
indexPath
.
row
];
id
asset
=
_selectedAssets
[
indexPath
.
item
];
BOOL
isVideo
=
NO
;
BOOL
isVideo
=
NO
;
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
if
([
asset
isKindOfClass
:[
PHAsset
class
]])
{
PHAsset
*
phAsset
=
asset
;
PHAsset
*
phAsset
=
asset
;
...
@@ -178,7 +178,7 @@
...
@@ -178,7 +178,7 @@
vc
.
model
=
model
;
vc
.
model
=
model
;
[
self
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
[
self
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
}
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
.
item
];
imagePickerVc
.
maxImagesCount
=
self
.
maxCountTF
.
text
.
integerValue
;
imagePickerVc
.
maxImagesCount
=
self
.
maxCountTF
.
text
.
integerValue
;
imagePickerVc
.
allowPickingGif
=
self
.
allowPickingGifSwitch
.
isOn
;
imagePickerVc
.
allowPickingGif
=
self
.
allowPickingGifSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
imagePickerVc
.
allowPickingOriginalPhoto
=
self
.
allowPickingOriginalPhotoSwitch
.
isOn
;
...
...
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