我有一个不适合屏幕的大水平视图,所以我把它放到了一个水平视图中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.")
}
}
}