如何将选择器列表滚动到所选行

时间:2020-01-01 14:54:06

标签: swiftui swiftui-form

我有一个选择器,代码如下所示。 allAccounts包含约300个值。选择器可以工作,但是它始终从列表的顶部开始。我希望列表自动滚动到选定的值。在iOS 13.3和Swift 5.1中有什么方法可以实现?

Picker("Account", selection: $thisItemInfo.shoppingItem.uuidAccount) {
                ForEach(allAccounts) { eachAccountInfo in
                    Text(eachAccountInfo.longName).tag(eachAccountInfo.id)
                }
            }

0 个答案:

没有答案
相关问题