SegmentedControl
原生分段选择器,支持值选择和中性的 Xcode 风格标签页角色。
#导入
从 github.com/egoist/quickgui/go/ui 导入 ui。
import (
"github.com/egoist/quickgui/go/native"
"github.com/egoist/quickgui/go/ui"
)#用法
func SwiftUiSegmentedControlExample() *native.Node {
value, setValue := ui.CreateSignal("list")
return ui.SwiftUI.Host(
ui.SwiftUIHostProps{MatchContents: true},
func() *native.Node {
return ui.SwiftUI.SegmentedControl(ui.SwiftUISegmentedControlProps{
Selection: value,
Options: []ui.SwiftUIPickerOption{{Value: "list", Label: "List"}, {Value: "grid", Label: "Grid"}},
OnSelectionChange: func(next string, _ *native.Event) { setValue(next) },
})
},
)
}#API 参考
展开条目查看说明和完整签名。短横线表示声明中未记录默认值。
SwiftUI.SegmentedControl
查看源码ui.SwiftUI.SegmentedControl(props SwiftUISegmentedControlProps) *native.NodeTestIDany—
Modifiersany—
Reffunc(*native.Node)—
Receives the retained native node after construction. Keep imperative work in event or lifecycle callbacks.
func(*native.Node)查看源码