与SwiftUI相等的子视图高度

时间:2020-04-01 07:26:23

标签: swiftui height equals

使Image(正方形)和TextOne的高度与填充高度相等。没有GeometryReader怎么办?

我不能使用GeometryReader,因为我将此视图用作List的行

var body: some View {
    return HStack {

        VStack {

            Image(systemName: "name").resizable().frame(width: ???, height: ???)

            Spacer()
        }

        VStack {
            HStack (alignment: .center) {

                Text("TextOne").padding()

                Spacer()

                Text("TextTwo").padding()
            }

            HStack (alignment: .top) {


                Text("TextDownOne").padding()

                Spacer()

                Button(action: { action() }) {
                    Text("ButtonText").padding()
                }
            }
        }
    }
}

0 个答案:

没有答案