问题描述
目前,我还没有找到针对 iOS 12.0 执行此操作的方法.我试过像这样设置条形色调.
Currently, I haven't found a way to do this for iOS 12.0. I've tried setting bar tint like so.
[mailController.navigationBar setTintColor:[UIColor whiteColor]];
然后,我尝试使用以下代码设置标题文本属性
Then, I tried setting the title text attribute with the following code
[mailController.navigationController.navigationBar setTitleTextAttributes:
@{NSForegroundColorAttributeName:[UIColor WhiteColor]};
我尝试了在 StackOverflow 上找到的更多选项,但都没有奏效.我希望有人找到一种可靠的方法来更改导航栏标题文本颜色.无论我做什么,它都会保持黑色.栏按钮的颜色正确更改,但导航栏标题没有正确更改.
I've tried more options that I found on StackOverflow, but none of them worked. I am hoping that someone found a reliable way to change the navigation bar title text color. It stays black no matter what I do. The bar button's colors change correctly, but not the navigation bar title.
推荐答案
您能否尝试其中一种可以让您设置导航栏颜色.例如:如果导航栏为黑色,则文本设置为白色.
Can you please try either one of these which lets you set the navigation bar color. For example: If the navigation bar is black color, then the text is set to white.
[[UINavigationBar 外观] setBarStyle: UIBarStyleBlack]
或
[[UINavigationBar 外观] setBarTintColor:[UIColor whiteColor]
这篇关于iOS 12.0:有没有办法将 MFMailComposeViewController 导航栏标题的文本设置为白色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!