SwiftUI—使用VStack在垂直方向排列视图

2020-07-15  本文已影响0人  anny_4243

原文链接:https://github.com/fzhlee/SwiftUI-Guide#-%E7%AC%AC3%E8%8A%82vstack-

VStack视图可以使其子视图,在垂直方向上进行等距排列。

示例代码:

struct ContentView : View {
    
    var body: some View {
        VStack{
            Text("The fruit and the tree")
                .font(.largeTitle)
            Image("Apple")
            Text("An apple is a sweet, edible fruit produced by an apple tree Apple trees are cultivated worldwide and are the most widely grown species in the genus Malus.")
                .font(.body)
                .lineLimit(nil)
                .frame(height: 200)
        }.padding()
    }
}
上一篇 下一篇

猜你喜欢

热点阅读