Search code examples
iosiphoneswiftuinavigationbaruitabbar

UINavigationBar & UITabbar tintColor not working in iPhone6Plus


I'm developing iOS app using Swift2 & Xcode7. I want to change UINavigationBar & UITabbar tintColor, so I write the below code in 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). In iPhone6S(iOS9.0) and iPhone5(iOS8.4), all are work well. Do you know reason?


Solution

  • Goto Settings > General > Accessibilty > Increase Contrast and turn off Darken Colors.

    Check this answer.