Change textColor of UINavigationBar “prompt”?

≯℡__Kan透↙ 提交于 2019-12-05 15:48:27

I guess the only way to really do it is to use a custom titleView for each UINavigationItem. You can use a UILabel and try to match the built-in navigation title style as closely as you can, then assign your own text color.

It's possible in iOS5:

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

And for iOS 7 you can make this to set the prompt to White Color. Please note that it will also change the color of the navbar title.

[[[self navigationController] navigationBar] setTitleTextAttributes:
  @{NSForegroundColorAttributeName:[UIColor whiteColor]}];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!