在iOS13中,状态栏背景色与大文本模式下的导航栏不同 [英] In iOS13 the status bar background colour is different from the navigation bar in large text mode
本文介绍了在iOS13中,状态栏背景色与大文本模式下的导航栏不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
重现问题的前提条件:
- Xcode 11 beta + iOS 13(最新版本至2019年6月12日)
- 导航栏处于大文本模式
- 指定导航栏的颜色.
在绿色导航栏上方的真实设备中,状态栏将保持白色.
The status bar will remain in white in a real device, above the green navigation bar.
我尝试过的解决方案:
- 将其还原回iOS12即可解决,但最终我们将遇到iOS13 ...
- 禁用大文本模式将解决此问题...
- 隐藏状态栏会解决此问题,但会导致状态文本与导航栏项重叠.
有什么想法吗?感谢您的帮助.
Any ideas? appreciate any help.
推荐答案
此处无需黑客或时髦.关键是定义所需的外观,并在导航栏的standardAppearance
及其scrollEdgeAppearance
上都设置此值.我的整个应用程序的基本导航控制器子类的初始化中都包含以下内容:
No hacks or funkiness required here. The key is defining the desired appearance and setting this value on BOTH the nav bar's standardAppearance
AND its scrollEdgeAppearance
. I have the following in the init for my base navigation controller subclass for my entire app:
if #available(iOS 13.0, *) {
let navBarAppearance = UINavigationBarAppearance()
navBarAppearance.configureWithOpaqueBackground()
navBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
navBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navBarAppearance.backgroundColor = <insert your color here>
navigationBar.standardAppearance = navBarAppearance
navigationBar.scrollEdgeAppearance = navBarAppearance
}
这篇关于在iOS13中,状态栏背景色与大文本模式下的导航栏不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文