簡體   English   中英

UINavigationBar和UITabbar tintColor在iPhone6Plus中不起作用

[英]UINavigationBar & UITabbar tintColor not working in iPhone6Plus

我正在使用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)中,選項卡選擇的圖標的顏色和導航欄圖標的顏色不是白色而是淺灰色。 在iPhone6S(iOS9.0)和iPhone5(iOS8.4)上,一切正常。 你知道原因嗎?

轉到Settings > General > Accessibilty > Increase Contrast並關閉Darken Colors

檢查此答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM