使用 2 个 HSplitView 在 swiftUI 中创建一个 3 窗格界面
·
Pet*_*ter 8
嗯,我会的。在断断续续地挣扎了几个星期之后,在我问这个问题一个小时后,我似乎解决了它!只需将第二个 HSplitView 的 layoutPriority 设置为 1,并将中心视图也设置为 1。当你想到它时是有道理的:
struct ContentView: View {
var body: some View {
GeometryReader{geometry in
HSplitView(){
Rectangle().foregroundColor(.red).frame(minWidth:200, idealWidth: 200, maxWidth: .infinity)
HSplitView(){
Rectangle().foregroundColor(.black).layoutPriority(1)
Rectangle().foregroundColor(.green).frame(minWidth:200, idealWidth: 200, maxWidth: .infinity)
}.layoutPriority(1)
}.frame(width: geometry.size.width, height: geometry.size.height)
}
}
}
很简单。喜欢 SwiftUI!
更多推荐

所有评论(0)