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
b6fc9da2
Commit
b6fc9da2
authored
Dec 24, 2021
by
yuzheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持横屏状态下进入裁剪模式
parent
c9044927
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+1
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+17
-3
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+5
-0
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
b6fc9da2
...
...
@@ -353,6 +353,7 @@
@interface
TZCommonTools
:
NSObject
+
(
UIEdgeInsets
)
tz_safeAreaInsets
;
+
(
BOOL
)
tz_isIPhoneX
;
+
(
BOOL
)
tz_isLandscape
;
+
(
CGFloat
)
tz_statusBarHeight
;
// 获得Info.plist数据字典
+
(
NSDictionary
*
)
tz_getInfoDictionary
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
b6fc9da2
...
...
@@ -521,9 +521,15 @@
-
(
void
)
setCropRect
:(
CGRect
)
cropRect
{
_cropRect
=
cropRect
;
if
([
TZCommonTools
tz_isLandscape
])
{
_cropRectLandscape
=
cropRect
;
CGFloat
widthHeight
=
cropRect
.
size
.
height
;
_cropRectPortrait
=
CGRectMake
(
cropRect
.
origin
.
y
,
(
self
.
view
.
tz_width
-
widthHeight
)
/
2
,
widthHeight
,
widthHeight
);
}
else
{
_cropRectPortrait
=
cropRect
;
CGFloat
widthHeight
=
cropRect
.
size
.
width
;
_cropRectLandscape
=
CGRectMake
((
self
.
view
.
tz_height
-
widthHeight
)
/
2
,
cropRect
.
origin
.
x
,
widthHeight
,
widthHeight
);
}
}
-
(
CGRect
)
cropRect
{
...
...
@@ -955,6 +961,14 @@
CGSizeEqualToSize
([
UIScreen
mainScreen
].
bounds
.
size
,
CGSizeMake
(
926
,
428
)));
}
+
(
BOOL
)
tz_isLandscape
{
if
([
UIApplication
sharedApplication
].
statusBarOrientation
==
UIDeviceOrientationLandscapeRight
||
[
UIApplication
sharedApplication
].
statusBarOrientation
==
UIDeviceOrientationLandscapeLeft
)
{
return
true
;
}
return
false
;
}
+
(
CGFloat
)
tz_statusBarHeight
{
if
([
UIWindow
instancesRespondToSelector
:
@selector
(
safeAreaInsets
)])
{
return
[
self
tz_safeAreaInsets
].
top
?:
20
;
...
...
TZImagePickerController/ViewController.m
View file @
b6fc9da2
...
...
@@ -361,6 +361,11 @@
NSInteger
left
=
30
;
NSInteger
widthHeight
=
self
.
view
.
tz_width
-
2
*
left
;
NSInteger
top
=
(
self
.
view
.
tz_height
-
widthHeight
)
/
2
;
if
([
TZCommonTools
tz_isLandscape
])
{
top
=
30
;
widthHeight
=
self
.
view
.
tz_height
-
2
*
left
;
left
=
(
self
.
view
.
tz_width
-
widthHeight
)
/
2
;
}
imagePickerVc
.
cropRect
=
CGRectMake
(
left
,
top
,
widthHeight
,
widthHeight
);
imagePickerVc
.
scaleAspectFillCrop
=
YES
;
// 设置横屏下的裁剪尺寸
...
...
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