Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS 15,当状态栏隐藏时,StatusBarHeightConstant 在 12 mini 和 13 mini 下的返回值不准确 #1326

Closed
nevsee opened this issue Nov 19, 2021 · 5 comments
Labels

Comments

@nevsee
Copy link

nevsee commented Nov 19, 2021

12mini和13mini高度为50

@MoLice
Copy link
Collaborator

MoLice commented Dec 14, 2021

并没有错?50是哪里测到的?
image

@nevsee
Copy link
Author

nevsee commented Dec 14, 2021

企业微信截图_377b5285-1ef8-4fdb-903f-1ad5cd480086

难道是iOS15 才会这样?

@MoLice
Copy link
Collaborator

MoLice commented Dec 14, 2021

以 iPhone 12 mini 为例。

在 iOS 14 里,这几个的值为:

StatusBarHeight = 44;
StatusBarHeightConstant = 44;
CGRectGetHeight(UIApplication.sharedApplication.statusBarFrame) = 44;
navigationBar.minY = 50; // 关键在这里,statusBar 底部是44,navigationBar 顶部却是 50,意味着中间有6的空隙
navigationBar.maxY = 94;// 对业务的内容布局无影响,不管 iOS 14、15 都是94

在 iOS 15 里,这几个的值为:

StatusBarHeight = 50;
StatusBarHeightConstant = 44;
CGRectGetHeight(UIApplication.sharedApplication.statusBarFrame) = 50;
navigationBar.minY = 50;// iOS 15 里两个 bar 从 frame 的角度来看是紧贴在一起的
navigationBar.maxY = 94;// 对业务的内容布局无影响,不管 iOS 14、15 都是94

不清楚系统在 iOS 14 下为什么会有 statusBar 是 44 但 navigationBar.minY 是 50 的区别,iOS 14 里 QMUI 的宏的值保证与系统动态获取的值一致即可。
iOS 15 下调整为返回 50。

但业务布局建议统一都以 UIViewController.qmui_navigationBarMaxYInViewCoordinator 为参考标准,就不会表现出这种差异。

@MoLice MoLice reopened this Jan 24, 2022
@MoLice
Copy link
Collaborator

MoLice commented Jan 24, 2022

issue 里提的场景应该有个前提,就是 statusBarHidden = YES,issue 当初并没有明确指出,新版本将会重新修复这个问题。

@MoLice MoLice changed the title StatusBarHeightConstant在12mini和13mini不准确 iOS 15,当状态栏隐藏时,StatusBarHeightConstant 在 12 mini 和 13 mini 下的返回值不准确 Jan 24, 2022
@MoLice
Copy link
Collaborator

MoLice commented Aug 10, 2022

已发布 4.5.0 修复该问题。

@MoLice MoLice closed this as completed Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants