UIBarButtonItem 色调颜色与设备上的颜色不同

UIBarButtonItem tint color not same color on device

我的项目中每个 UIViewController 至少有一个 UIBarButtonItem's,一切都在 UINavigationController 中,UINavigationBar 是蓝色的,UIBarButtonItem's 应该是白色的.

在模拟器中它们是白色的...但在设备中它们是浅灰色的,如下图所示:

模拟器

设备

它们 运行 完全相同的代码和完全相同的 ios 版本 ios 8.1

我目前正在将情节提要中的色调设置为白色,但我也尝试过:

// In appdelegate
UINavigationBar.appearance().barTintColor = UIColor(hex: 0x4a9bcb, alpha: 1.0)
UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName:UIFont(name: "FuturaLT-Bold", size: 16)!, NSForegroundColorAttributeName:UIColor(white: 1.0, alpha: 1.0)]
UIBarButtonItem.appearance().tintColor = UIColor.whiteColor()

// In map viewcontroller viewDidLoad 
self.edgesForExtendedLayout = UIRectEdge.None
self.navigationController?.navigationBar.translucent = false

结果相同。

请帮助我了解发生了什么。

这很可能是由于顶部 NavigationBar 的 alpha(透明度)处于打开状态。当内容在顶部栏下方滑动时,它会显示底层视图的百分比,导致您的白人不是白人。

您可以通过关闭 NavigationBar 上的透明度来消除它:

self.navigationController.navigationBar.translucent = NO;

或者通过设置停止内容在栏下滚动:

edgesForExtendedLayout = UIRectEdgeNone;

有关扩展布局和透明导航栏的详细信息和解释,请参阅此 Whosebug answer

我发现哪里出了问题.........在设置中 General/Accessibility/Increase 对比度下有一个选项叫做更深的颜色...我打开了它使色调颜色更深(当然)。好傻