【发布时间】:2020-11-22 02:30:45
【问题描述】:
我试图隐藏视图的 statusBar,但我注意到它在 macOS 中不起作用,Blur 也不起作用 opacity不工作!看起来我正在尝试编程新语言,苹果说代码到位并应用到任何地方!为什么我不能在 macOS 中完成这些简单的任务?
struct ContentView: View {
var body: some View {
HStack {
Button { print("OK was clicked!") } label: { Text("OK").frame(width: 100) }
Button { print("Close was clicked!") } label: { Text("Close").frame(width: 100) }
}
.frame(width: 400, height: 200)
.background(Color.white.opacity(0.4).blur(radius: 0.5))
//.statusBar(hidden: true)
}
}
import SwiftUI
@main
struct macOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
【问题讨论】:
-
这是否回答了您的问题stackoverflow.com/a/60252103/12299030?
-
也谢谢我没有看到 App Delegate!?