Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在特定的ViewController中将状态栏颜色更改为灯光_Ios_Swift - Fatal编程技术网

Ios 在特定的ViewController中将状态栏颜色更改为灯光

Ios 在特定的ViewController中将状态栏颜色更改为灯光,ios,swift,Ios,Swift,我研究过互联网,发现我应该怎么做,但当我尝试它时,似乎什么都没有发生。天还黑吗?我做错了什么 将查看基于控制器的状态栏外观设置为是 在ViewDidLoad 添加下面的代码 override func preferredStatusBarStyle() -> UIStatusBarStyle { return UIStatusBarStyle.LightContent } 可能有其他内容正在覆盖您的设置。例如,如果您在导航控制器中,您可能会发现您需要子类化UINavigati

我研究过互联网,发现我应该怎么做,但当我尝试它时,似乎什么都没有发生。天还黑吗?我做错了什么

  • 查看基于控制器的状态栏外观
    设置为
  • ViewDidLoad
  • 添加下面的代码

    override func preferredStatusBarStyle() -> UIStatusBarStyle {
         return UIStatusBarStyle.LightContent
    }
    

  • 可能有其他内容正在覆盖您的设置。例如,如果您在导航控制器中,您可能会发现您需要子类化
    UINavigationController
    ,以设置状态栏颜色。

    视图中使用它将显示

    UIApplication.sharedApplication().setStatusBarStyle(.LightContent, animated: false)
    

    第一次将
    查看基于控制器的状态栏外观
    设置为
    。 可以这样设置吗

    navigationViewController.navigationBar.barStyle = UIBarStyle. LightContent
    

    所以我需要对我的navigationController子类化,然后在其中插入代码,或者怎么样?