【问题标题】:UINavigationBar & UITabbar tintColor not working in iPhone6PlusUINavigationBar 和 UITabbar tintColor 在 iPhone6Plus 中不起作用
【发布时间】:2015-12-20 10:10:31
【问题描述】:

我正在使用 Swift2 和 Xcode7 开发 iOS 应用程序。我想更改 UINavigationBar & UITabbar tintColor,所以我在 AppDelegate.swift 中编写了以下代码。

UINavigationBar.appearance().barTintColor = UIColor.appThemeColor()
UINavigationBar.appearance().titleTextAttributes = [
    NSForegroundColorAttributeName:UIColor.blackColor(),
    NSFontAttributeName:UIFont.systemFontOfSize(20.0)
]
UINavigationBar.appearance().tintColor = UIColor.whiteColor()

UITabBarItem.appearance().setTitleTextAttributes([
    NSForegroundColorAttributeName:UIColor.whiteColor(),
    NSFontAttributeName:UIFont.boldSystemFontOfSize(12.0)
    ], forState: UIControlState.Selected)
UITabBarItem.appearance().setTitleTextAttributes([
    NSFontAttributeName:UIFont.boldSystemFontOfSize(12.0)
    ], forState: UIControlState.Normal)
UITabBar.appearance().tintColor = UIColor.whiteColor()
UITabBar.appearance().barTintColor = UIColor.appThemeColor()

但仅在 iPhone6plus(iOS8.1) 中,tabbar selected icon 的颜色和导航栏 icon 的颜色不是白色而是浅灰色。在 iPhone6S(iOS9.0) 和 iPhone5(iOS8.4) 中,一切正常。你知道原因吗?

【问题讨论】:

    标签: ios iphone swift uinavigationbar uitabbar


    【解决方案1】:

    转到Settings > General > Accessibilty > Increase Contrast 并关闭Darken Colors

    检查this answer

    【讨论】:

    • 谢谢!这就是我要找的。​​span>
    猜你喜欢
    • 1970-01-01
    • 2013-06-07
    • 1970-01-01
    • 1970-01-01
    • 2014-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多