我想在Swift应用程序Xcode 8中的启动屏幕中隐藏状态栏 .

在目标属性下,我将“状态栏最初隐藏”值设置为“是”以隐藏我的启动屏幕中的状态栏 .

然后,为了使状态栏在应用程序中可见,我在AppDelegate文件中以编程方式将“isStatusBarHidden”值设置为“No”:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.


        UIApplication.shared.statusBarStyle = .lightContent
        UIApplication.shared.statusBarView?.backgroundColor = UIColor(red:0.77, green:0.07, blue:0.00, alpha:1.0)

        UIApplication.shared.isStatusBarHidden = false

        return true
    }

此代码使我的状态栏显示在应用程序中,但状态栏显示有延迟 . 这是事情发生的顺序:

1-启动屏幕显示没有状态栏(按预期)

2-第一个视图显示菜单上方的菜单和白色空状态栏 .

3-状态栏显示红色,电池和订单图标 .

我希望我的状态栏出现在我的第一个视图之前,但我不知道该怎么做 .

  • PS,我在didFinishLaunchingWithOptions函数中改变了行的顺序而没有运气 .

  • PSS,我是IOS开发的新手 .

这是我正在使用的证明!
enter image description here