iOS13 / Xcode 11上的大标题导航栏为黑色

问题描述 投票:0回答:1

因为我将Xcode更新到版本11 /我的设备更新到iOS 13,所以在使用大标题时,导航栏的背景颜色更改为黑色:large titles

奇怪的是,常规标题不会发生这种情况:regular titles

我已经强制进入亮模式(因为我还没有为暗模式更新资产),并检查了所有可用的界面选项。将导航栏的背景色设置为白色时,状态栏仍保持黑色-我在这里做错了什么?settings

感谢您的帮助。

ios navigationbar ios13 xcode11
1个回答
0
投票
iOS 13及更高版本中,默认情况下,大标题导航栏不包含背景材料或阴影。另外,随着人们开始滚动内容,大型标题会转换为标准标题

if #available(iOS 13.0, *) { let appearance = UINavigationBarAppearance() appearance.backgroundColor = .purple appearance.titleTextAttributes = [.foregroundColor: UIColor.white] appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white] UINavigationBar.appearance().tintColor = .white UINavigationBar.appearance().standardAppearance = appearance UINavigationBar.appearance().compactAppearance = appearance UINavigationBar.appearance().scrollEdgeAppearance = appearance } else { UINavigationBar.appearance().tintColor = .white UINavigationBar.appearance().barTintColor = .purple UINavigationBar.appearance().isTranslucent = false }

也可以参考下面的解决方案

In iOS13 the status bar background colour is different from the navigation bar in large text mode

© www.soinside.com 2019 - 2024. All rights reserved.