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

查看:126
本文介绍了状态栏文本颜色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上看到的问题很少,如这个这个这个但它们没有多大帮助。也可能是因为我无法在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天全站免登陆