赞
踩
https://developer.apple.com/documentation/swiftui/scrollview
struct ContentView : View
{
var body: some View
{
ScrollView(.vertical, showsIndicators: false)
{
VStack(alignment: HorizontalAlignment.leading, spacing: 20)
{
Text("Overview")
.font(.system(size: 48))
.padding(10)
Text("With the power of Xcode, the ease of Swift, and the revolutionary features of cutting-edge Apple technologies, you have the freedom to create your most innovative apps ever.\nSwiftUI provides views, controls, and layout structures for declaring your app's user interface. ")
.lineLimit(nil)
.frame(width: 300, height: 160, alignment: .topLeading)
.padding(10)
Image("iPhone")
.resizable()
.frame(width: 300, height: 556, alignment: .center)
}
}
.background(Color.yellow)
.padding(10)
.navigationBarTitle(Text("ScrollView"))
}
}
struct ContentView : View
{
var body: some View
{
ScrollView(.horizontal, showsIndicators: true)
{
HStack(alignment:.center, spacing: 20)
{
ForEach( 1 ..< 8)
{i in
Image("0\(i)")
.resizable()
.scaledToFill()
.frame(height: 160)
}
}
}
.padding(20)
.background(Color.black.opacity(0.1))
}
}
struct ContentView : View
{
var body: some View
{
ScrollView(.vertical, showsIndicators: false)
{
VStack(alignment: HorizontalAlignment.leading, spacing: 10)
{
Text("Overview")
.font(.system(size: 48))
.padding(20)
Text("SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. Build user interfaces for any Apple device using just one set of tools and APIs.")
.lineLimit(nil)
.frame(width: 300, height: 120, alignment: .topLeading)
.padding(20)
ScrollView(.horizontal, showsIndicators: true)
{
HStack(alignment:.center, spacing: 20)
{
Image("iPhone")
.resizable()
.frame(width: 189, height: 350, alignment: .center)
Image("iPhoneSerial")
.resizable()
.frame(width: 518, height: 350, alignment: .center)
Image("iPhone")
.resizable()
.frame(width: 189, height: 350, alignment: .center)
}
}
.padding(10)
.background(Color.black)
}
}
.background(Color.orange)
.padding(10)
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。