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
d6d6a6e9
Commit
d6d6a6e9
authored
Nov 14, 2017
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化isIPhoneX方法,iPhone10,6是美版iPhoneX
parent
08b39be0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+2
-2
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+6
-5
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+3
-3
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+2
-2
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
d6d6a6e9
...
...
@@ -237,7 +237,7 @@
@interface
TZCommonTools
:
NSObject
+
(
BOOL
)
isIPhoneX
;
+
(
CGFloat
)
statusBarHeight
;
+
(
BOOL
)
tz_
isIPhoneX
;
+
(
CGFloat
)
tz_
statusBarHeight
;
@end
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
d6d6a6e9
...
...
@@ -642,7 +642,7 @@
BOOL
isStatusBarHidden
=
[
UIApplication
sharedApplication
].
isStatusBarHidden
;
if
(
self
.
navigationController
.
navigationBar
.
isTranslucent
)
{
top
=
naviBarHeight
;
if
(
iOS7Later
&&
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
statusBarHeight
];
if
(
iOS7Later
&&
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
tz_
statusBarHeight
];
tableViewHeight
=
self
.
view
.
tz_height
-
top
;
}
else
{
tableViewHeight
=
self
.
view
.
tz_height
;
...
...
@@ -713,7 +713,7 @@
@implementation
TZCommonTools
+
(
BOOL
)
isIPhoneX
{
+
(
BOOL
)
tz_
isIPhoneX
{
struct
utsname
systemInfo
;
uname
(
&
systemInfo
);
NSString
*
platform
=
[
NSString
stringWithCString
:
systemInfo
.
machine
encoding
:
NSASCIIStringEncoding
];
...
...
@@ -721,12 +721,13 @@
// 模拟器下采用屏幕的高度来判断
return
[
UIScreen
mainScreen
].
bounds
.
size
.
height
==
812
;
}
BOOL
isIPhoneX
=
[
platform
isEqualToString
:
@"iPhone10,3"
];
// iPhone10,6是美版iPhoneX 感谢hegelsu指出:https://github.com/banchichen/TZImagePickerController/issues/635
BOOL
isIPhoneX
=
[
platform
isEqualToString
:
@"iPhone10,3"
]
||
[
platform
isEqualToString
:
@"iPhone10,6"
];
return
isIPhoneX
;
}
+
(
CGFloat
)
statusBarHeight
{
return
[
self
isIPhoneX
]
?
44
:
20
;
+
(
CGFloat
)
tz_
statusBarHeight
{
return
[
self
tz_
isIPhoneX
]
?
44
:
20
;
}
@end
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
d6d6a6e9
...
...
@@ -266,10 +266,10 @@ static CGFloat itemMargin = 5;
CGFloat
collectionViewHeight
=
0
;
CGFloat
naviBarHeight
=
self
.
navigationController
.
navigationBar
.
tz_height
;
BOOL
isStatusBarHidden
=
[
UIApplication
sharedApplication
].
isStatusBarHidden
;
CGFloat
toolBarHeight
=
[
TZCommonTools
isIPhoneX
]
?
50
+
(
83
-
49
)
:
50
;
CGFloat
toolBarHeight
=
[
TZCommonTools
tz_
isIPhoneX
]
?
50
+
(
83
-
49
)
:
50
;
if
(
self
.
navigationController
.
navigationBar
.
isTranslucent
)
{
top
=
naviBarHeight
;
if
(
iOS7Later
&&
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
statusBarHeight
];
if
(
iOS7Later
&&
!
isStatusBarHidden
)
top
+=
[
TZCommonTools
tz_
statusBarHeight
];
collectionViewHeight
=
tzImagePickerVc
.
showSelectBtn
?
self
.
view
.
tz_height
-
toolBarHeight
-
top
:
self
.
view
.
tz_height
-
top
;;
}
else
{
collectionViewHeight
=
tzImagePickerVc
.
showSelectBtn
?
self
.
view
.
tz_height
-
toolBarHeight
:
self
.
view
.
tz_height
;
...
...
@@ -290,7 +290,7 @@ static CGFloat itemMargin = 5;
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
}
else
{
CGFloat
navigationHeight
=
naviBarHeight
;
if
(
iOS7Later
)
navigationHeight
+=
[
TZCommonTools
statusBarHeight
];
if
(
iOS7Later
)
navigationHeight
+=
[
TZCommonTools
tz_
statusBarHeight
];
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
-
navigationHeight
;
}
_bottomToolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
d6d6a6e9
...
...
@@ -217,7 +217,7 @@
[
super
viewDidLayoutSubviews
];
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
CGFloat
statusBarHeight
=
[
TZCommonTools
statusBarHeight
];
CGFloat
statusBarHeight
=
[
TZCommonTools
tz_
statusBarHeight
];
CGFloat
statusBarHeightInterval
=
statusBarHeight
-
20
;
CGFloat
naviBarHeight
=
statusBarHeight
+
_tzImagePickerVc
.
navigationBar
.
tz_height
;
_naviBar
.
frame
=
CGRectMake
(
0
,
0
,
self
.
view
.
tz_width
,
naviBarHeight
);
...
...
@@ -237,7 +237,7 @@
[
_collectionView
reloadData
];
}
CGFloat
toolBarHeight
=
[
TZCommonTools
isIPhoneX
]
?
44
+
(
83
-
49
)
:
44
;
CGFloat
toolBarHeight
=
[
TZCommonTools
tz_
isIPhoneX
]
?
44
+
(
83
-
49
)
:
44
;
CGFloat
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
_toolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
...
...
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