我不明白如何解决这个问题...我只想在我的应用程序在 iPad 上以 2/3 拆分视图打开时显示不同的布局...这里有一些图像可以让您更好地理解...
问题是当应用程序处于 1/2 拆分视图时可见的文本,当应用程序处于 2/3 拆分视图时也必须可见...
目前,代码是这样的:
GeometryReader { geometry in
if geometry.size.height > geometry.size.width && sizeClass == .compact { // OK
VStack(alignment: .center) {
Text("Per mostrare la barra laterale")
.font(.title)
.foregroundColor(.gray)
Text("scorri dal lato sinistro,")
.font(.title)
.foregroundColor(.gray)
Text("poi seleziona una categoria")
.font(.title)
.foregroundColor(.gray)
}
.frame(width: geometry.size.width, height: geometry.size.height)
} else if geometry.size.height > geometry.size.width && sizeClass == .regular { // OK
VStack(alignment: .center) {
Text("Per mostrare la barra laterale")
.font(.title)
.foregroundColor(.gray)
Text("scorri dal lato sinistro,")
.font(.title)
.foregroundColor(.gray)
Text("poi seleziona una categoria")
.font(.title)
.foregroundColor(.gray)
}
.frame(width: geometry.size.width, height: geometry.size.height)
} else if geometry.size.height < geometry.size.width && sizeClass == .regular { // OK in full screen, not in 2/3
VStack(alignment: .center) {
Text("Seleziona una categoria")
.font(.title)
.foregroundColor(.gray)
Text("dalla barra laterale")
.font(.title)
.foregroundColor(.gray)
}
.frame(width: geometry.size.width, height: geometry.size.height)
}
}
有没有办法解决这个问题?任何帮助表示赞赏...谢谢!