美文网首页
SwiftUI—创建一个水平方向上的滚动视图

SwiftUI—创建一个水平方向上的滚动视图

作者: anny_4243 | 来源:发表于2020-07-16 10:58 被阅读0次

原文链接: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)
        }
    }

相关文章

网友评论

      本文标题:SwiftUI—创建一个水平方向上的滚动视图

      本文链接:https://www.haomeiwen.com/subject/vjauhktx.html