My application has a dark background, but in iOS 7 the status bar became transparent. So I can't see anything there, only the green battery indicator in the corner. How can I change the status bar text color to white like it is on the home screen?
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How can I vertically align my status bar item text
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
Well, this is really working like a piece of cake for me.
Go to your app's
info.plist
.View controller-based status bar appearance
toNO
Status bar style
toUIStatusBarStyleLightContent
Then go to your app's delegate and paste in the following code where you set your windows's RootViewController.
Bingo. It's working for me.
iOS 7 allows individual view controllers to determine the appearance of the status bar, as described by the Apple developer documentation:
Setting the status bar appearance globally is a two-step process.
First, you need to tell iOS that you don't want to set the status bar appearance on a view-by-view basis.
Then you need to take charge and actually set the new global status bar style.
To disable view-by-view status bar control, you'll need to set the
View controller-based status bar appearance
property inInfo.plist
.Open the Project Navigator and select the project for your iOS app, then select the Info tab.
Hover over a row, then click the plus sign that appears to add a new property to your
.plist
.Enter
View controller-based status bar appearance
in the Key field, then make sure the Type field is set toBoolean
. Finally, enterNO
in the Value field.To set a global style for the status bar, add another property under the Info tab with a key of
Status bar style
, a Type ofString
and a Value ofOpaque black style
.Here's a blog post with a little more detail and some sample code:
http://codebleep.com/setting-the-status-bar-text-color-in-ios-7/
You can do this without writing any line of code!
Do the following to make the status bar text color white through the whole app
On you project plist file:
Transparent black style (alpha of 0.5)
NO
NO
I did some things different and it works for me.
With no changes in code, I did config my .plist file like this:
I hope it helps.
edit
For each view controller I change the "status bar"'s Simulated Metrics property, in storyboard, from "inferred" to "Light Content"
Go to
Project
->Target
,Then set
Status Bar Style
toLight
. It makes status-bar white from the launch screen.Then set
View controller-based status bar appearance
equal toNO
inInfo.plist
.Simply calling
in the
method of my
AppDelegate
works great for me in iOS7.