Commit 8a652a57 authored by RayJiang's avatar RayJiang

修复iOS13顶部留白的问题

parent aa519070
...@@ -782,9 +782,10 @@ ...@@ -782,9 +782,10 @@
CGFloat tableViewHeight = 0; CGFloat tableViewHeight = 0;
CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height; CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;
BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden; BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;
BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;
if (self.navigationController.navigationBar.isTranslucent) { if (self.navigationController.navigationBar.isTranslucent) {
top = naviBarHeight; top = naviBarHeight;
if (!isStatusBarHidden) top += [TZCommonTools tz_statusBarHeight]; if (!isStatusBarHidden && isFullScreen) top += [TZCommonTools tz_statusBarHeight];
tableViewHeight = self.view.tz_height - top; tableViewHeight = self.view.tz_height - top;
} else { } else {
tableViewHeight = self.view.tz_height; tableViewHeight = self.view.tz_height;
......
...@@ -303,10 +303,11 @@ static CGFloat itemMargin = 5; ...@@ -303,10 +303,11 @@ static CGFloat itemMargin = 5;
CGFloat collectionViewHeight = 0; CGFloat collectionViewHeight = 0;
CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height; CGFloat naviBarHeight = self.navigationController.navigationBar.tz_height;
BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden; BOOL isStatusBarHidden = [UIApplication sharedApplication].isStatusBarHidden;
BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;
CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 50 + (83 - 49) : 50; CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 50 + (83 - 49) : 50;
if (self.navigationController.navigationBar.isTranslucent) { if (self.navigationController.navigationBar.isTranslucent) {
top = naviBarHeight; top = naviBarHeight;
if (!isStatusBarHidden) top += [TZCommonTools tz_statusBarHeight]; if (!isStatusBarHidden && isFullScreen) top += [TZCommonTools tz_statusBarHeight];
collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight - top : self.view.tz_height - top;; collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight - top : self.view.tz_height - top;;
} else { } else {
collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight : self.view.tz_height; collectionViewHeight = tzImagePickerVc.showSelectBtn ? self.view.tz_height - toolBarHeight : self.view.tz_height;
......
...@@ -247,8 +247,9 @@ ...@@ -247,8 +247,9 @@
[super viewDidLayoutSubviews]; [super viewDidLayoutSubviews];
TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController; TZImagePickerController *_tzImagePickerVc = (TZImagePickerController *)self.navigationController;
CGFloat statusBarHeight = [TZCommonTools tz_statusBarHeight]; BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;
CGFloat statusBarHeightInterval = statusBarHeight - 20; CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;
CGFloat statusBarHeightInterval = isFullScreen ? (statusBarHeight - 20) : 0;
CGFloat naviBarHeight = statusBarHeight + _tzImagePickerVc.navigationBar.tz_height; CGFloat naviBarHeight = statusBarHeight + _tzImagePickerVc.navigationBar.tz_height;
_naviBar.frame = CGRectMake(0, 0, self.view.tz_width, naviBarHeight); _naviBar.frame = CGRectMake(0, 0, self.view.tz_width, naviBarHeight);
_backButton.frame = CGRectMake(10, 10 + statusBarHeightInterval, 44, 44); _backButton.frame = CGRectMake(10, 10 + statusBarHeightInterval, 44, 44);
......
...@@ -140,7 +140,8 @@ ...@@ -140,7 +140,8 @@
- (void)viewDidLayoutSubviews { - (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews]; [super viewDidLayoutSubviews];
CGFloat statusBarHeight = [TZCommonTools tz_statusBarHeight]; BOOL isFullScreen = self.view.tz_height == [UIScreen mainScreen].bounds.size.height;
CGFloat statusBarHeight = isFullScreen ? [TZCommonTools tz_statusBarHeight] : 0;
CGFloat statusBarAndNaviBarHeight = statusBarHeight + self.navigationController.navigationBar.tz_height; CGFloat statusBarAndNaviBarHeight = statusBarHeight + self.navigationController.navigationBar.tz_height;
_playerLayer.frame = self.view.bounds; _playerLayer.frame = self.view.bounds;
CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 44 + (83 - 49) : 44; CGFloat toolBarHeight = [TZCommonTools tz_isIPhoneX] ? 44 + (83 - 49) : 44;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment