【发布时间】:2021-08-01 21:46:00
【问题描述】:
我有一个不适合屏幕的大水平视图,因此我将其放入水平视图ScrollView。
如果 0 代表完全向左滚动,而 1 代表完全向右滚动 - 我该怎么做?滚动到 0.8 的相对位置?
由于我无法将 id 附加到子元素 ScrollViewReader 似乎不起作用。
struct ContentView: View {
var body: some View {
ScrollView(.horizontal) {
Text("Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on. Example for a long view without individual elements that you could use id on.")
}
}
}
【问题讨论】:
标签: swift swiftui scrollview horizontalscrollview scrollviewreader