简体   繁体   English

UINavigationBar和UITabbar tintColor在iPhone6Plus中不起作用

[英]UINavigationBar & UITabbar tintColor not working in iPhone6Plus

I'm developing iOS app using Swift2 & Xcode7. 我正在使用Swift2和Xcode7开发iOS应用。 I want to change UINavigationBar & UITabbar tintColor, so I write the below code in AppDelegate.swift. 我想更改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()

But tabbar selected icon's color and navigation bar icon's color are not white but lightgray-ish in only iPhone6plus(iOS8.1). 但是仅在iPhone6plus(iOS8.1)中,选项卡选择的图标的颜色和导航栏图标的颜色不是白色而是浅灰色。 In iPhone6S(iOS9.0) and iPhone5(iOS8.4), all are work well. 在iPhone6S(iOS9.0)和iPhone5(iOS8.4)上,一切正常。 Do you know reason? 你知道原因吗?

Goto Settings > General > Accessibilty > Increase Contrast and turn off Darken Colors . 转到Settings > General > Accessibilty > Increase Contrast并关闭Darken Colors

Check this answer . 检查此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM