【发布时间】:2021-09-09 10:30:55
【问题描述】:
我正在尝试将 barTintColor 从 SceneDelegate 更改为,但它并没有覆盖整个顶部区域。看看我的ss:
如何让它覆盖整个顶部区域?
这是我的代码,提前谢谢你。
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
UINavigationBar.appearance().barTintColor = UIColor(displayP3Red: 47/225, green: 54/225, blue: 64/225, alpha: 1.0)
UINavigationBar.appearance().backgroundColor = UIColor(displayP3Red: 47/225, green: 54/225, blue: 64/225, alpha: 1.0)
UINavigationBar.appearance().largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white]
}
}
【问题讨论】:
标签: ios swift uikit navigationbar