【问题标题】:Navigationbar white tintcolor looks gray导航栏白色 tintcolor 看起来是灰色的
【发布时间】:2014-08-02 06:21:06
【问题描述】:

我正在开发一个支持 iOS 7 及更高版本的应用程序,使用带有“绿色”bartintcolor 的导航栏。但是,将“tintcolor”设置为白色时遇到了问题。它变成了灰色而不是白色(如下图所示)。

谢谢,

【问题讨论】:

    标签: objective-c ios7 uinavigationbar uinavigationitem


    【解决方案1】:

    我遇到了同样的问题,花了很多时间解决。

    1. 转到 iOS 设置 > 常规 > 辅助功能 > 增加对比度。
    2. 关闭“深色”开关。

    【讨论】:

    • 谢谢。你节省了我的 2 天时间。
    【解决方案2】:

    请将以下代码添加到您的 appdelegate 文件中

      [[UINavigationBar appearance] setTitleTextAttributes:@{ UITextAttributeTextColor: [UIColor whiteColor],UITextAttributeFont: [UIFont fontWithName:@"FONT_NAME" size:15] }];
    

    【讨论】:

    • UITextAttributeTextColor 和 UITextAttributeFont 在 iOS 7 中都已弃用。
    • 我使用了新的建议属性:“NSForegroundColorAttributeName”和“NSFontAttributeName”,它似乎根本不起作用。
    • 如果要添加导航栏按钮,则必须将该按钮添加为导航栏中的自定义按钮
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    相关资源
    最近更新 更多