首页 > 解决方案 > SwiftUI - edgesIgnoringSafeArea 在 iOS 13.4 中的行为不同

问题描述

我注意到在我的应用程序中,.edgesIgnoringSafeArea 在 iOS 13.3 和 iOS 13.4 中呈现的视图不同。

在我的 ContentView 中,我应用了 .edgesIgnoringSafeArea(.top) 修饰符。这在 13.4 之前的所有 iOS 13 版本中都能正确显示。现在在 13.4 的 GM 中,视图的顶部和底部被切断了。

这是我的内容视图

struct ContentView: View {
@EnvironmentObject var session: SessionStore
func getUser() {
    session.listen()
}



var body: some View {

        Group {
            ZStack {
                TabView {
                    ExploreView().tabItem {
                        Image(systemName: "house.fill")
                        Text("Explore")
                    }.tag(1)
                    FestivalsView().tabItem {
                        Image(systemName: "globe")
                        Text("Festivals")
                    }.tag(2)
                    ProfileView().tabItem {
                        Image(systemName: "person.crop.circle.fill")
                        Text("Profile")
                    }.tag(3)
                }
                .accentColor(Color("wdwPurple"))
                .edgesIgnoringSafeArea(.top)
    }
        }.onAppear(perform: getUser)
    }
}

这是它的显示方式:

在此处输入图像描述

有任何想法吗?

标签: swiftui

解决方案


我删除了修饰符,它似乎正确显示。就像其他人所说的那样,模拟器并不能很好地指示事物在实际设备上的实际呈现方式。


推荐阅读