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
493cd726
Commit
493cd726
authored
Jun 30, 2016
by
banchichen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Arthurli-feature-add-linespace'
parents
ec731436
3db92e15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
10 deletions
+35
-10
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+35
-10
No files found.
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
493cd726
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
UILabel
*
_numberLable
;
UILabel
*
_numberLable
;
UIButton
*
_originalPhotoButton
;
UIButton
*
_originalPhotoButton
;
UILabel
*
_originalPhotoLable
;
UILabel
*
_originalPhotoLable
;
CGFloat
_minimumLineSpacing
;
}
}
@end
@end
...
@@ -43,6 +45,7 @@
...
@@ -43,6 +45,7 @@
_assetsTemp
=
[
NSMutableArray
arrayWithArray
:
_tzImagePickerVc
.
selectedAssets
];
_assetsTemp
=
[
NSMutableArray
arrayWithArray
:
_tzImagePickerVc
.
selectedAssets
];
self
.
isSelectOriginalPhoto
=
_tzImagePickerVc
.
isSelectOriginalPhoto
;
self
.
isSelectOriginalPhoto
=
_tzImagePickerVc
.
isSelectOriginalPhoto
;
}
}
_minimumLineSpacing
=
20
;
[
self
configCollectionView
];
[
self
configCollectionView
];
[
self
configCustomNaviBar
];
[
self
configCustomNaviBar
];
[
self
configBottomToolBar
];
[
self
configBottomToolBar
];
...
@@ -57,7 +60,7 @@
...
@@ -57,7 +60,7 @@
[
super
viewWillAppear
:
animated
];
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
];
if
(
iOS7Later
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
if
(
iOS7Later
)
[
UIApplication
sharedApplication
].
statusBarHidden
=
YES
;
if
(
_currentIndex
)
[
_collectionView
setContentOffset
:
CGPointMake
((
self
.
view
.
tz_width
)
*
_currentIndex
,
0
)
animated
:
NO
];
if
(
_currentIndex
)
[
_collectionView
setContentOffset
:
CGPointMake
((
self
.
view
.
tz_width
+
_minimumLineSpacing
)
*
_currentIndex
,
0
)
animated
:
NO
];
[
self
refreshNaviBarAndBottomBarState
];
[
self
refreshNaviBarAndBottomBarState
];
}
}
...
@@ -152,12 +155,11 @@
...
@@ -152,12 +155,11 @@
layout
.
scrollDirection
=
UICollectionViewScrollDirectionHorizontal
;
layout
.
scrollDirection
=
UICollectionViewScrollDirectionHorizontal
;
layout
.
itemSize
=
CGSizeMake
(
self
.
view
.
tz_width
,
self
.
view
.
tz_height
);
layout
.
itemSize
=
CGSizeMake
(
self
.
view
.
tz_width
,
self
.
view
.
tz_height
);
layout
.
minimumInteritemSpacing
=
0
;
layout
.
minimumInteritemSpacing
=
0
;
layout
.
minimumLineSpacing
=
0
;
layout
.
minimumLineSpacing
=
_minimumLineSpacing
;
_collectionView
=
[[
UICollectionView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
)
collectionViewLayout
:
layout
];
_collectionView
=
[[
UICollectionView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
view
.
tz_width
,
self
.
view
.
tz_height
)
collectionViewLayout
:
layout
];
_collectionView
.
backgroundColor
=
[
UIColor
blackColor
];
_collectionView
.
backgroundColor
=
[
UIColor
blackColor
];
_collectionView
.
dataSource
=
self
;
_collectionView
.
dataSource
=
self
;
_collectionView
.
delegate
=
self
;
_collectionView
.
delegate
=
self
;
_collectionView
.
pagingEnabled
=
YES
;
_collectionView
.
scrollsToTop
=
NO
;
_collectionView
.
scrollsToTop
=
NO
;
_collectionView
.
showsHorizontalScrollIndicator
=
NO
;
_collectionView
.
showsHorizontalScrollIndicator
=
NO
;
_collectionView
.
contentOffset
=
CGPointMake
(
0
,
0
);
_collectionView
.
contentOffset
=
CGPointMake
(
0
,
0
);
...
@@ -248,11 +250,11 @@
...
@@ -248,11 +250,11 @@
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
-
(
void
)
scrollViewDidScroll
:(
UIScrollView
*
)
scrollView
{
CGPoint
offSet
=
scrollView
.
contentOffset
;
CGPoint
offSet
=
scrollView
.
contentOffset
;
CGFloat
offSetWidth
=
offSet
.
x
;
CGFloat
offSetWidth
=
offSet
.
x
;
if
((
offSetWidth
+
(
self
.
view
.
tz_width
*
0
.
5
))
<
scrollView
.
contentSize
.
width
)
{
if
((
offSetWidth
+
(
(
self
.
view
.
tz_width
+
_minimumLineSpacing
)
*
0
.
5
))
<
scrollView
.
contentSize
.
width
+
_minimumLineSpacing
)
{
offSetWidth
=
offSetWidth
+
(
self
.
view
.
tz_width
*
0
.
5
);
offSetWidth
=
offSetWidth
+
(
(
self
.
view
.
tz_width
+
_minimumLineSpacing
)
*
0
.
5
);
}
}
NSInteger
currentIndex
=
offSetWidth
/
self
.
view
.
tz_width
;
NSInteger
currentIndex
=
offSetWidth
/
(
self
.
view
.
tz_width
+
_minimumLineSpacing
)
;
if
(
_currentIndex
!=
currentIndex
)
{
if
(
_currentIndex
!=
currentIndex
)
{
_currentIndex
=
currentIndex
;
_currentIndex
=
currentIndex
;
...
@@ -284,20 +286,43 @@
...
@@ -284,20 +286,43 @@
return
cell
;
return
cell
;
}
}
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
willDisplayCell
:(
UICollectionViewCell
*
)
cell
forItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
-
(
void
)
collectionView
:(
UICollectionView
*
)
collectionView
willDisplayCell
:(
UICollectionViewCell
*
)
cell
forItemAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
{
if
([
cell
isKindOfClass
:[
TZPhotoPreviewCell
class
]])
{
if
([
cell
isKindOfClass
:[
TZPhotoPreviewCell
class
]])
{
[(
TZPhotoPreviewCell
*
)
cell
recoverSubviews
];
[(
TZPhotoPreviewCell
*
)
cell
recoverSubviews
];
}
}
}
}
-
(
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
];
}
}
}
}
-
(
void
)
scrollViewWillEndDragging
:(
UIScrollView
*
)
scrollView
withVelocity
:(
CGPoint
)
velocity
targetContentOffset
:(
inout
CGPoint
*
)
targetContentOffset
{
CGFloat
contentOffsetX
=
scrollView
.
contentOffset
.
x
;
NSInteger
MAX_INDEX
=
(
scrollView
.
contentSize
.
width
+
_minimumLineSpacing
)
/
(
self
.
view
.
tz_width
+
_minimumLineSpacing
)
-
1
;
NSInteger
MIN_INDEX
=
0
;
NSInteger
index
=
contentOffsetX
/
(
self
.
view
.
tz_width
+
_minimumLineSpacing
);
if
(
velocity
.
x
>
0
.
4
&&
contentOffsetX
<
(
*
targetContentOffset
).
x
)
{
index
=
index
+
1
;
}
else
if
(
velocity
.
x
<
-
0
.
4
&&
contentOffsetX
>
(
*
targetContentOffset
).
x
)
{
index
=
index
;
}
else
if
(
contentOffsetX
>
(
index
+
0
.
5
)
*
(
self
.
view
.
tz_width
+
_minimumLineSpacing
))
{
index
=
index
+
1
;
}
if
(
index
>
MAX_INDEX
)
index
=
MAX_INDEX
;
if
(
index
<
MIN_INDEX
)
index
=
MIN_INDEX
;
CGPoint
newTargetContentOffset
=
CGPointMake
(
index
*
(
self
.
view
.
tz_width
+
_minimumLineSpacing
),
0
);
*
targetContentOffset
=
CGPointMake
(
scrollView
.
contentOffset
.
x
,
0
);
[
scrollView
setContentOffset
:
newTargetContentOffset
animated
:
YES
];
}
#pragma mark - Private Method
#pragma mark - Private Method
-
(
void
)
refreshNaviBarAndBottomBarState
{
-
(
void
)
refreshNaviBarAndBottomBarState
{
...
...
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