【发布时间】:2022-11-12 07:35:39
【问题描述】:
我已经使用 HStack for macOS 应用程序构建了一个具有水平类型滚动视图的视图。有没有办法使用键盘箭头圈出这些项目?
(我看到 ListView 具有默认行为,但对于其他自定义视图类型则没有)
click here to see the screenshot
var body: some View {
VStack {
ScrollView(.horizontal, {
HStack {
ForEach(items.indices, id: \.self) { index in
//custom view for default state and highlighted state
}
}
}
}
}
any help is appreciated :)
【问题讨论】:
-
这回答了你的问题了吗? SwiftUI keyboard navigation in lists on MacOS
-
@workingdogsupportUkraine 不幸的是不,它使用 List 而在我的情况下我不能使用 List 因为它必须水平滚动
-
使用水平滚动添加了答案。
标签: ios swift swiftui scrollview hstack