【发布时间】:2020-05-17 00:24:21
【问题描述】:
macOS HIG 建议分段控件可以是多选的: https://developer.apple.com/design/human-interface-guidelines/macos/selectors/segmented-controls/
但是 SwiftUI SegmentedPickerStyle 似乎没有旋钮来配置它。这只是 SwiftUI for macOS 中尚未实现的一个案例吗?
Picker(selection: self.$pickerSelection, label: Text("")) {
Text("One").tag(0)
Text("Two").tag(1)
Text("Three").tag(2)
}.pickerStyle(SegmentedPickerStyle())
我似乎无法找到此处引用的 SelectionValue 的定义: https://developer.apple.com/documentation/swiftui/picker/3271572-init
这里的选择值可以是数组吗?
【问题讨论】:
-
SwiftUI 现在不支持,使用 NSSegmentedControl/NSViewRepresentable