我在VStack中有两个视图。一切看起来都很好,直到我尝试在辅助功能设置中放大字体为止。然后由于某种原因,堆栈无法扩展以容纳两个视图。相反,它是将一个视图推到另一个视图之上。见下文。
如何正确对齐它们?下面是我的代码。
var body: some View {
VStack(spacing: 10) {
Text("Lorem ipsum dolor sit amet,consectetur adipiscing elit,sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.")
.fixedSize(horizontal: false,vertical: true)
.padding()
GeometryReader { geometry in
VStack(spacing: 0) {
Image("tmp")
.resizable()
.scaledToFill()
.frame(width: geometry.size.width * 0.88)
VStack(spacing: 10) {
Text("Lorem ipsum dolor sit amet,consectetur adipiscing elit")
.frame(width: geometry.size.width * 0.8,alignment: .leading)
.fixedSize(horizontal: false,vertical: true)
Text("Lorem ipsum dolor sit amet,vertical: true)
}
.padding()
.background(
Rectangle()
.fill(Color.white)
)
}
.cornerRadius(10)
.edgesIgnoringSafeArea(.all)
}
.scaledToFit()
.shadow(color: .gray,radius: 10,x: 5,y: 5)
.scaledToFill()
Spacer()
}
.background(Rectangle()
.fill(Color.gray)
.scaledToFill())
}