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
Note: Most upvoted answer does not work for iOS 7 / 8
In Info.plist set 'View controller-based status bar appearance' as NO
In AppDelegate add
to
This solution works for iOS 7 / 8
Alternatively, you can opt out of the view-controller based status bar appearance:
View controller-based status bar appearance
toNO
in yourInfo.plist
.[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Note: This method has been deprecated in iOS9. Use
preferredStatusBarStyle
on the UIViewController instead. (see Apple Developer Library)This is documented in the iOS 7 UI Transition Guide, which you need an Apple developer ID to access directly. The relevant excerpt:
Also possibly of interest:
I'd definitely recommend having a look through the document, which, again, you can access with your Apple developer ID.
If you still want to use
View controller-based status bar appearance
in info.plist set to YES, meaning that you can change the statusbar for each view-controller, use the following for white text in the status-bar in ViewDidLoad:Let me give you a complete answer to your question. Changing the status bar text color is very easy but its a little confusing in iOS 7 specially for newbies.
If you are trying to change the color 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.
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.
ios 7 status bar text color
Lastly, you have to go to your AppDelegate.m file and add the following in didFinishLaunchingWithOptions method, add the following line:
This will change the color to white for all your view controllers. Hope this helps!
This works in Golden Master iOS 7 and Xcode 5 GM seed and iOS7 SDK released on September 18th, 2013 (at least with navigation controller hidden):
Set
the UIViewControllerBasedStatusBarAppearance
toNO
in theInfo.plist
.In
ViewDidLoad
method or anywhere, where do you want to change status bar style:[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];