Closed StefaniOSApps closed 5 years ago
I fix this bug @andreamazz
please replace:
var statusBarHeight: CGFloat {
var statusBarHeight = UIApplication.shared.statusBarFrame.size.height
if #available(iOS 11.0, *) {
// Account for the notch when the status bar is hidden
statusBarHeight = max(UIApplication.shared.statusBarFrame.size.height, UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0)
}
return statusBarHeight - extendedStatusBarDifference
}
with
var statusBarHeight: CGFloat {
var statusBarHeight = UIApplication.shared.statusBarFrame.size.height
if #available(iOS 11.0, *) {
// Account for the notch when the status bar is hidden
statusBarHeight = max(UIApplication.shared.statusBarFrame.size.height, UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0)
}
return max(statusBarHeight - extendedStatusBarDifference, 0)
}
Describe the bug There are problems if a UIViewController is not represented by "push" but by "present". Then there is an erroneous calculation of the UINavigationBar position. This creates a strong offset. The relative position of the UIViewcontollers.view must be taken into account in the position of the device window.
To Reproduce Steps to reproduce the behavior: See screenshot animation
Expected behavior No offset. A correct calculation of the uinavigationbar.
Screenshots https://imgur.com/a/YTxh8dx
Demo Project https://github.com/StefaniOSApps/Example Run Demo on iPad, press on "table", scroll down and up .. see offset at the top.