如何在 SwiftUI 中隐藏状态栏 [英] How to hide the status bar in SwiftUI

查看:39
本文介绍了如何在 SwiftUI 中隐藏状态栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 SwiftUI 中隐藏状态栏.我尝试过statusBar(hidden: true)"方法,但它不起作用.是否有任何解决方案可以在 SwiftUI 中实现.

I want to hide the status bar in SwiftUI. I have try the method "statusBar(hidden: true)", but it doesn't work. Is there any solution to make it in SwiftUI.

演示代码如下:

var body: some View {
        VStack {
            Text("Hello World")

        }
        .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
        .background(Color.blue)
        .edgesIgnoringSafeArea(.all)
        .statusBar(hidden: true)

    }

推荐答案

.edgesIgnoringSafeArea(.all)
.statusBar(hidden: true)

试试这个

这篇关于如何在 SwiftUI 中隐藏状态栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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