簡體   English   中英

更改UINavigationBar“提示”的textColor?

[英]Change textColor of UINavigationBar “prompt”?

這樣做的任何(支持)方式? 當使用“比X更暗”的tintColor時,它通常會在某個時刻切換為白色,但我們似乎只是處於我們的方案的邊緣。

這在iOS5中是可能的:

[[UINavigationBar appearance] setTitleTextAttributes:
      [NSDictionary dictionaryWithObjectsAndKeys:
       [UIColor whiteColor], UITextAttributeTextColor, nil]];

我想真正做到這一點的唯一方法是為每個UINavigationItem使用自定義titleView 您可以使用UILabel並嘗試盡可能匹配內置導航標題樣式,然后指定自己的文本顏色。

對於iOS 7,您可以將其設置為白色。 請注意,它還會更改導航欄標題的顏色。

[[[self navigationController] navigationBar] setTitleTextAttributes:
  @{NSForegroundColorAttributeName:[UIColor whiteColor]}];

暫無
暫無

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

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