I followed this thread to override -preferredStatusBarStyle
, but it isn't called.
Are there any options that I can change to enable it? (I'm using XIBs in my project.)
相关问题
- 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 do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
For anyone still struggling with this, this simple extension in swift should fix the problem for you.
UIStatusBarStyle in iOS 7
The status bar in iOS 7 is transparent, the view behind it shows through.
The style of the status bar refers to the appearances of its content. In iOS 7, the status bar content is either dark (
UIStatusBarStyleDefault
) or light (UIStatusBarStyleLightContent
). BothUIStatusBarStyleBlackTranslucent
andUIStatusBarStyleBlackOpaque
are deprecated in iOS 7.0. UseUIStatusBarStyleLightContent
instead.How to change
UIStatusBarStyle
If below the status bar is a navigation bar, the status bar style will be adjusted to match the navigation bar style (
UINavigationBar.barStyle
):Specifically, if the navigation bar style is UIBarStyleDefault, the status bar style will be
UIStatusBarStyleDefault
; if the navigation bar style isUIBarStyleBlack
, the status bar style will beUIStatusBarStyleLightContent
.If there is no navigation bar below the status bar, the status bar style can be controlled and changed by an individual view controller while the app runs.
-
[UIViewController preferredStatusBarStyle]
is a new method added in iOS 7. It can be overridden to return the preferred status bar style:If the status bar style should be controlled by a child view controller instead of self, override
-[UIViewController childViewControllerForStatusBarStyle]
to return that child view controller.If you prefer to opt out of this behavior and set the status bar style by using the
-[UIApplication statusBarStyle]
method, add theUIViewControllerBasedStatusBarAppearance
key to an app’sInfo.plist
file and give it the value NO.