【问题标题】:Globally update color for navbarbutton items全局更新导航栏按钮项目的颜色
【发布时间】:2018-01-07 13:58:34
【问题描述】:

我已通过在 App Delegate 文件中应用以下内容来全局更新 tabBarItems 的颜色:

UITabBar.appearance().tintColor = .black

除了将更改应用到 navBarButton 项之外,是否可以这样做?我找到的解决方案适用于 iOS 4 或 5。

【问题讨论】:

  • UIBarButtonItem.appearance() 呢?
  • 最好在按钮中具体指定要自定义的内容以及要自定义的按钮,因为方法可能不同。

标签: ios swift navbar


【解决方案1】:

要全局更改外观更改它在AppDelegate didFinishLaunchingWithOptions:

var navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.black
navigationBarAppearace.barTintColor = UIColor.blue
// Item title color
navigationBarAppearace.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white]

【讨论】:

    猜你喜欢
    • 2014-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多