The height for the picker items.
Instance Method
インスタンスメソッド
default
defaultWheelPickerItemHeight(_:)
Sets the default wheel-style picker item height.
省略時の環形式ピッカー項目の高さを設定します。
Availability 有効性
- watchOS 6.0+
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
height
Discussion 議論
Use default
when you need to change the default item height in a picker control. In this example, the view sets the default height for picker elements to 30 points.
struct DefaultWheelPickerItemHeight: View {
private var selected = 1
var body: some View {
VStack(spacing: 20) {
Picker(selection: $selected, label: Text("Favorite Color")) {
Text("Red").tag(1)
Text("Green").tag(2)
Text("Blue").tag(3)
Text("Other").tag(4)
}
}
.defaultWheelPickerItemHeight(30)
}
}