状态栏文本颜色 iOS 7 [英] Status Bar Text Color iOS 7

查看:23
本文介绍了状态栏文本颜色 iOS 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法更改 iOS 7 SDK 状态栏中的文本颜色.目前它是黑色的,我希望故事板中的所有视图控制器都是白色的.

I am unable to change the text colour in the status bar in iOS 7 SDK. Currently its black and i want it to be white for all my view controllers in a storyboard.

我在 StackOverflow 上看到的问题很少,比如 THIS, 这个这个但他们没有多大帮助.也可能是因为我无法在我的 plist 文件中找到 UIViewControllerBasedStatusBarAppearance 为 YES.

I have seen few questions on StackOverflow like THIS, THIS and THIS but they didn't of much help. Also may be due to the fact that i am unable to find UIViewControllerBasedStatusBarAppearance to YES in my plist file.

谁能告诉我将故事板中所有视图控制器的状态栏文本颜色设置为白色的正确方法吗?提前致谢!

Can any one tell me the right way to set the status bar text colour to white for all view controllers in the storyboard? Thanks in advance!

推荐答案

让我给你一个完整的答案.更改状态栏文本颜色非常容易,但在 iOS 7 中特别适合新手.

Let me give you a complete answer to your question. Changing the status bar text colour is very easy but its a little confusing in iOS 7 specially for newbies.

如果您尝试通过选择视图控制器并转到右侧的模拟指标"将 StoryBoard 中的颜色从黑色更改为白色,它将不起作用,我不知道为什么.它应该通过像这样改变但无论如何都可以工作.

If you are trying to change the colour from black to white in StoryBoard by selecting the view controller and going to Simulated Metrics on the right side, it won't work and i don't know why. It should work by changing like this but any how.

其次,您不会在 plist 中找到 UIViewControllerBasedStatusBarAppearance 属性,但默认情况下它不存在.您必须通过单击 + 按钮自行添加它,然后将其设置为 NO.

Secondly, you won't find UIViewControllerBasedStatusBarAppearance property in your plist but by default its not there. You have to add it by yourself by clicking on the + button and then set it to NO.

最后,您必须转到您的 AppDelegate.m 文件并在 didFinishLaunchingWithOptions 方法中添加以下内容,添加以下行:

Lastly, you have to go to your AppDelegate.m file and add the following in didFinishLaunchingWithOptions method, add the following line:

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

这会将所有视图控制器的颜色更改为白色.希望这会有所帮助!

This will change the colour to white for all your view controllers. Hope this helps!

这篇关于状态栏文本颜色 iOS 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆