原文链接:https://github.com/fzhlee/SwiftUI-Guide#-%E7%AC%AC11%E8%8A%82scrollview-horizontal-
本节课继续演示ScrollView滚动视图的使用,您将创建一个水平方向上的滚动视图。
示例代码:
struct ContentView : View {
var body: some View {
ScrollView(.horizontal, showsIndicators: true) {
HStack(alignment:.center, spacing: 20){
Image("iPhone")
.resizable()
.frame(width: 300, height: 556, alignment: .center)
Image("iPhoneSerial")
.resizable()
.frame(width: 823, height: 556, alignment: .center)
Image("iPhone")
.resizable()
.frame(width: 300, height: 556, alignment: .center)
}
}
.background(Color.orange)
.padding(10)
}
}
网友评论