Any (supported) way of doing this? IIRC it usually switches over by itself to a white color at some point when using a "darker than X" tintColor, but we seem to be just on the edge with our scheme.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
回答2:
It's possible in iOS5:
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor, nil]];
回答3:
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]}];