[英]SwiftUI Webview fullscreen issue
我试图让 WebView 适合屏幕但我不能这样尝试
import SwiftUI
extension View {
func toAnyView() -> AnyView{
AnyView(self)
}
}
struct ContentView: View {
@State private var showLoding: Bool = false
@State private var scrollViewContentOffset: CGFloat = .zero
var body: some View {
ZStack{
WebView(url: URL(string: "http://localhost:3000")!, showLoding: $showLoding)
.overlay(showLoding ? ProgressView("Loding...").toAnyView(): EmptyView().toAnyView())
.ignoresSafeArea()
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .center)
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
但这就是结果照片我无法让堆栈在状态栏下上升
尝试在帧后使用“.ignoresSafeArea()”
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity, alignment: .center)
.ignoresSafeArea()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.