Мой код:
Код: Выделить всё
struct ContentView: View {
var body: some View {
VStack(spacing: 0) {
VStack(spacing: 0) {
Rectangle()
.foregroundColor(.red)
.frame(height: 100)
Spacer()
.frame(minHeight: 10, maxHeight: 100)
Rectangle()
.foregroundColor(.green)
.frame(height: 100)
Spacer()
.frame(minHeight: 10, maxHeight: 100)
Rectangle()
.foregroundColor(.blue)
.frame(height: 100)
}
Spacer()
.frame(minHeight: 10, maxHeight: 600)
Rectangle() // keyboard
.frame(height: 200)
}
}
}
Проставки с maxHeight: 100 имеют высоту = 10 (а не 100) на iPhone 11 Pro Max. (НО пространство между черным видом и VStack позволяет это)
Как реализовать поведение, которое я объяснил?


Подробнее здесь: https://stackoverflow.com/questions/591 ... for-spacer
Мобильная версия