gpt4 book ai didi

ios - 如何删除 ZStack SwiftUI 中的填充

转载 作者:行者123 更新时间:2023-12-05 08:11:12 26 4
gpt4 key购买 nike

<分区>

当我试图将另一个 VStack 放入 ZStack 时,我得到了奇怪的填充。如何删除它?

struct ContentView: View {
var body: some View {
VStack{
VStack{
Text("1")
}
.frame(width: 200, height: 50)
.background(Color.init(.green))

ZStack{
VStack{
Text("2")
}
.frame(width: 210, height: 50)
.background(Color.init(.blue))
VStack{
Text("3")
}
.frame(width: 200, height: 50)
.background(Color.init(.green))
}

VStack{
Text("4")
}
.frame(width: 200, height: 50)
.background(Color.init(.green))
}
}

如果我用 Text("2") 评论 VStack,填充将消失。

Screenshot of weird padding

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com