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
2f626ac0
Commit
2f626ac0
authored
Sep 21, 2021
by
yuzheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复横屏裁剪时图片位置不对的问题
parent
9e6af874
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
...erController/TZImagePickerController/TZPhotoPreviewCell.m
+5
-5
No files found.
TZImagePickerController/TZImagePickerController/TZPhotoPreviewCell.m
View file @
2f626ac0
...
@@ -325,15 +325,15 @@
...
@@ -325,15 +325,15 @@
if
(
_allowCrop
)
{
if
(
_allowCrop
)
{
// 1.7.2 如果允许裁剪,需要让图片的任意部分都能在裁剪框内,于是对_scrollView做了如下处理:
// 1.7.2 如果允许裁剪,需要让图片的任意部分都能在裁剪框内,于是对_scrollView做了如下处理:
// 1.让contentSize增大(裁剪框右下角的图片部分)
// 1.让contentSize增大(裁剪框右下角的图片部分)
CGFloat
contentWidthAdd
=
self
.
scrollView
.
tz_width
-
CGRectGetMaxX
(
_cropRect
)
;
CGFloat
contentWidthAdd
=
(
MIN
(
_imageContainerView
.
tz_width
,
self
.
scrollView
.
tz_width
)
-
_cropRect
.
size
.
width
)
/
2
;
CGFloat
contentHeightAdd
=
(
MIN
(
_imageContainerView
.
tz_height
,
self
.
tz_height
)
-
self
.
cropRect
.
size
.
height
)
/
2
;
CGFloat
contentHeightAdd
=
(
MIN
(
_imageContainerView
.
tz_height
,
self
.
scrollView
.
tz_height
)
-
_
cropRect
.
size
.
height
)
/
2
;
CGFloat
newSizeW
=
self
.
scrollView
.
contentSize
.
width
+
contentWidthAdd
;
CGFloat
newSizeW
=
MAX
(
self
.
scrollView
.
contentSize
.
width
,
self
.
scrollView
.
tz_width
)
+
contentWidthAdd
;
CGFloat
newSizeH
=
MAX
(
self
.
scrollView
.
contentSize
.
height
,
self
.
tz_height
)
+
contentHeightAdd
;
CGFloat
newSizeH
=
MAX
(
self
.
scrollView
.
contentSize
.
height
,
self
.
scrollView
.
tz_height
)
+
contentHeightAdd
;
_scrollView
.
contentSize
=
CGSizeMake
(
newSizeW
,
newSizeH
);
_scrollView
.
contentSize
=
CGSizeMake
(
newSizeW
,
newSizeH
);
_scrollView
.
alwaysBounceVertical
=
YES
;
_scrollView
.
alwaysBounceVertical
=
YES
;
// 2.让scrollView新增滑动区域(裁剪框左上角的图片部分)
// 2.让scrollView新增滑动区域(裁剪框左上角的图片部分)
if
(
contentHeightAdd
>
0
||
contentWidthAdd
>
0
)
{
if
(
contentHeightAdd
>
0
||
contentWidthAdd
>
0
)
{
_scrollView
.
contentInset
=
UIEdgeInsetsMake
(
contentHeightAdd
,
_cropRect
.
origin
.
x
,
0
,
0
);
_scrollView
.
contentInset
=
UIEdgeInsetsMake
(
contentHeightAdd
,
contentWidthAdd
,
0
,
0
);
}
else
{
}
else
{
_scrollView
.
contentInset
=
UIEdgeInsetsZero
;
_scrollView
.
contentInset
=
UIEdgeInsetsZero
;
}
}
...
...
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