Skip to content

Instantly share code, notes, and snippets.

@hujunfeng
Last active March 20, 2019 14:20
Show Gist options
  • Save hujunfeng/6651254 to your computer and use it in GitHub Desktop.
Save hujunfeng/6651254 to your computer and use it in GitHub Desktop.

Revisions

  1. hujunfeng revised this gist Sep 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ios7statusbar.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@

    * 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 one type of status bar style:
    `-[UIViewController preferredStatusBarStyle]` is a new method added in iOS 7. It can be overridden to return the preferred status bar style:

    - (UIStatusBarStyle)preferredStatusBarStyle
    {
  2. hujunfeng revised this gist Sep 21, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ios7statusbar.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@

    Specifically, if the navigation bar style is `UIBarStyleDefault`, the status bar style will be `UIStatusBarStyleDefault`; if the navigation bar style is `UIBarStyleBlack`, the status bar style will be `UIStatusBarStyleLightContent`.

    * 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 apps.
    * 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 one type of status bar style:

  3. hujunfeng revised this gist Sep 21, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ios7statusbar.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,10 @@
    #### `UIStatusBarStyle` in iOS 7
    ### `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`). Both `UIStatusBarStyleBlackTranslucent` and `UIStatusBarStyleBlackOpaque` are deprecated in iOS 7.0. Use `UIStatusBarStyleLightContent` instead.

    #### How to change `UIStatusBarStyle`
    ### 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`):

  4. hujunfeng created this gist Sep 21, 2013.
    24 changes: 24 additions & 0 deletions ios7statusbar.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    #### `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`). Both `UIStatusBarStyleBlackTranslucent` and `UIStatusBarStyleBlackOpaque` are deprecated in iOS 7.0. Use `UIStatusBarStyleLightContent` 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 is `UIBarStyleBlack`, the status bar style will be `UIStatusBarStyleLightContent`.

    * 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 apps.

    `-[UIViewController preferredStatusBarStyle]` is a new method added in iOS 7. It can be overridden to return one type of status bar style:

    - (UIStatusBarStyle)preferredStatusBarStyle
    {
    return UIStatusBarStyleLightContent;
    }

    * 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 the `UIViewControllerBasedStatusBarAppearance` key to an app’s Info.plist file and give it the value `NO`.