Ios 在SwiftUI VStack中,如何创建多个文本视图,每个视图具有多行文本,宽度相同

Ios 在SwiftUI VStack中,如何创建多个文本视图,每个视图具有多行文本,宽度相同,ios,swiftui,vstack,Ios,Swiftui,Vstack,我试图使VStack中的文本具有相同的宽度,但不知道如何进行。我在别处看到建议为每个文本视图将frame maxWidth设置为.infinity,但在代码中尝试时没有任何效果 这是我的代码: struct ContentView: View { var body: some View { VStack(alignment: .center, spacing: 8.0) { Spacer() Text("Young

我试图使VStack中的文本具有相同的宽度,但不知道如何进行。我在别处看到建议为每个文本视图将frame maxWidth设置为.infinity,但在代码中尝试时没有任何效果

这是我的代码:

struct ContentView: View {
    var body: some View {
        VStack(alignment: .center, spacing: 8.0) {
            Spacer()
            Text("Youngsters can play in Kids mode. If you're feeling very adventurous you can play in BigKids mode.")
                .padding(.horizontal)
            Text("Kids mode uses large images and big differences between the number of images shown.")
                .padding(.horizontal)
            Text("BigKids mode, on the other hand, uses small images and small differences between the number of images shown. Go for it!")
                .padding(.horizontal)
            Spacer()
        }
        .frame(maxWidth: 600.0)
    }
}

我使用的VStack框架最大宽度为600,因为我不希望它比使用iPad时宽

下面是代码的结果。请注意,每个文本视图的宽度不同


将VStack对齐设置为
。引导
而不是
。居中
会给你带来你想要的效果吗?会的,@sia-谢谢!或者你可以试试