简体   繁体   English

iOS 13 新页面表格/表格表格导航栏高度

[英]iOS 13 new pageSheet/formSheet navigationBar Height

As we can see from image below, the new presentation style of iOS 13 built with XCode 11 made navigation bar have a different height (56 height) compared to the one presented 'fullscreen' (44 height).从下图可以看出,iOS 13 采用 XCode 11 构建的新呈现风格使得导航栏的高度(56 高度)与呈现的“全屏”(44 高度)不同。

The problem here is my app is using a custom written navigation bar and the height of the custom navigation bar is calculated with UINavigationController.navigationBar.frame.height which give us 44 height as default.这里的问题是我的应用程序正在使用自定义的书面导航栏,自定义导航栏的高度是使用UINavigationController.navigationBar.frame.height计算的,默认为 44 高度。 We are trying to adopt to the new presentation style, but I could not think of a work-around.我们正在尝试采用新的演示风格,但我想不出解决方法。 I think I'm also not covered situation such as large title navigation bar and compact navigation bar.我想我也没有涵盖大标题导航栏和紧凑导航栏等情况。 Any help would be greatly appreciated.任何帮助将不胜感激。

Credits to: https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e 归功于:https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e

在此处输入图像描述 2) Image with navigationBar Height of 56 in presentationStyle.pageSheet 2)presentationStyle.pageSheet 中 navigationBar 高度为 56 的图像

在此处输入图像描述 3) Image with navigationBar Height of 44 in presentationStyle.fullScreen 3)presentationStyle.fullScreen 中 navigationBar 高度为 44 的图像

This is seems to be a bug in iOS, I've used this workaround , but I call it in viewDidLoad instead of viewWillAppear because the latter applied the fix only after the view controller animation finished.这似乎是 iOS 中的一个错误,我已经使用了这个解决方法,但我在viewDidLoad而不是viewWillAppear中调用它,因为后者仅在视图 controller Z6F1C25ED15235062F1BBF9DEE 完成后才应用修复。

override func viewDidLoad(_ animated: Bool) {  
     // ... 
     if #available(iOS 13.0, *) {  
          navigationController?.navigationBar.setNeedsLayout()  
     }  
}  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iOS 13中的formSheet和pageSheet UIModalPresentationStyle有什么区别? - What's the difference between formSheet and pageSheet UIModalPresentationStyle in iOS 13? 为什么显示 Google 插页式广告会改变我的 NavigationBar 的高度? Xcode 11.3,iOS 13 - Why does displaying a Google Interstitial Ad change the height of my NavigationBar? Xcode 11.3, iOS 13 iOS13 - 导航栏标题颜色问题 - iOS13 - problem with navigationBar title color iOS 13 如何在导航栏中隐藏UISearchController searchBar - iOS 13 How to hide UISearchController searchBar in navigationBar 导航栏iPhone中横向模式下的iOS UISearchBar高度 - iOS UISearchBar height in landscape mode in navigationBar iPhone 获取iOS上NavigationBar的默认高度(或maxY) - Get the default height (or maxY) of a NavigationBar on iOS iOS是否有可能观察者更改navigationBar的高度? - iOS is it possible observer changes navigationBar height? 如何在 iOS 11 中更改导航栏高度? - How to change navigationBar height in iOS 11? iOS 13:使用 UINavigationBarAppearance 时忽略 NavigationBar BarStyle - iOS 13: NavigationBar BarStyle is ignored when using UINavigationBarAppearance iPad上modalPresentationStyle-FormSheet的高度到底是多少? - What exactly is the height of modalPresentationStyle - FormSheet on iPad?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM