iOS 13 中的 PrefersStatusBarHidden 问题 [英] prefersStatusBarHidden issue in iOS 13

查看:35
本文介绍了iOS 13 中的 PrefersStatusBarHidden 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试将我的 statusBar 隐藏在 View Controller 中,但它似乎不起作用.. 我使用了该功能:

<小时>

 覆盖 var prefersStatusBarHidden: Bool {返回真}

<小时>

我还将plist文件中的基于视图控制器的状态栏外观设置为YES

我的状态栏不想隐藏......我哪里做错了?

解决方案

看起来您正试图在单个 ViewController 中专门隐藏状态栏.

为了做到这一点,您需要在 ViewController

中有以下内容

self.modalPresentationCapturesStatusBarAppearance = true

override var prefersStatusBarHidden: Bool {返回假}

我还在我的 .plist 中添加了 View controller-based status bar appearance 并将其设置为 YES.

在最新的 iOS 13 上测试过.

Hi everyone I'm trying to hide my statusBar in a View Controller but it doesn't seem to work .. I used the function:


 override var prefersStatusBarHidden: Bool {
         return true
    }


I also set the View controller-based status bar appearance in the plist file to YES

My status bar doesn't want to hide ... where am I doing wrong?

解决方案

It looks like you're trying to specifically hide the status bar in a single ViewController.

In order to do that, you need have the following in that ViewController

self.modalPresentationCapturesStatusBarAppearance = true

override var prefersStatusBarHidden: Bool {
      return false
}

I also added View controller-based status bar appearance in my .plist and set it to YES.

Tested on the latest iOS 13.

这篇关于iOS 13 中的 PrefersStatusBarHidden 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆