gpt4 book ai didi

ios - 如何更改全局导航栏背景颜色?

转载 作者:行者123 更新时间:2023-11-30 10:59:25 33 4
gpt4 key购买 nike

我想更改导航栏的全局背景颜色。我怎样才能做到这一点?

行:

UINavigationBar.appearance().backgroundColor = UIColor.green

application(_:, didFinishLaunchingWithOptions:)不起作用,同时:

UINavigationBar.appearance().tintColor = UIColor.red

工作正常。

最佳答案

在这种情况下使用色调颜色:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UINavigationBar.appearance().barTintColor = UIColor.green
UINavigationBar.appearance().tintColor = UIColor.white
UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor:UIColor.white]

return true
}

iOS applies tint color to app icons, tab bars, navigation bars and manyother things.

关于ios - 如何更改全局导航栏背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53559479/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com