【发布时间】:2019-11-24 06:08:11
【问题描述】:
我有 List 有 100 个项目
我想滚动到项目编号 20
我如何在SwiftUI 中实现这一点
这是我的简单 ListCode
struct ContentView: View {
var body: some View {
List {
Button(action: {
self.scrollToIndex(index: 20)
}) {
Text("Scroll To 20")
}
ForEach(0..<100) {_ in
Text("Hello World")
}
}
}
func scrollToIndex(index: Int) {
}
}
【问题讨论】: