zoukankan      html  css  js  c++  java
  • UIStatusBarStyle PreferredStatusBarStyle does not work on iOS 7

    Q:

    In my iPhone application built with Xcode 5 for iOS 7 I set UIViewControllerBasedStatusBarAppearance=YES in info.plist, and in my ViewController I have this code:

    -(UIStatusBarStyle) preferredStatusBarStyle{
        returnUIStatusBarStyleLightContent;
    }

    But the status bar is still black against the black background.

    I know its possible to change this app-wide by setting UIViewControllerBasedStatusBarAppearance=NO in info.plist, but I actually need to alter this on a viewController by viewController basis at runtime.

    A:

    I discovered that if your ViewController is inside a navigationController then the navigationController’s navigationBar.barStyle determines the statusBarStyle.

    Setting your navigationBar’s barStyle to UIBarStyleBlackTranslucent will give white status bar text (ie. UIStatusBarStyleLightContent), and UIBarStyleDefault will give black status bar text (ie. UIStatusBarStyleDefault).

    Note that this applies even if you totally change the navigationBar’s color via its barTintColor.

  • 相关阅读:
    BZOJ 1055 [HAOI2008]玩具取名
    BZOJ 1054 [HAOI2008]移动玩具
    BestCoder Round #51 (div.2)
    python对拍程序
    BZOJ 1053 [HAOI2007]反素数ant
    BZOJ 1051 [HAOI2006]受欢迎的牛
    Codeforces Round #315 (Div. 2)
    今天愉快的hack小记
    BZOJ 1050 [HAOI2006]旅行comf
    COJ 2135 Day10-例1
  • 原文地址:https://www.cnblogs.com/lingzhao/p/3962821.html
Copyright © 2011-2022 走看看