![](/img/trans.png)
[英]SwiftUI - Remove padding around Picker SegmentedPickerStyle when in a Form Section
[英]How to change height of a Picker with SegmentedPickerStyle() in SwiftUI?
SwiftUI中的Picker Frame怎么改?
Picker(selection: .constant(1), label: Text("Picker")) {
Text("Hello").tag(1)
Text("World").tag(2)
}
.frame(height: 60)
.pickerStyle(SegmentedPickerStyle())
我們希望選擇器高度等於60
,但事實並非如此。
沒有直接的方法來更改SegmentedPickerStyle
選擇器的高度,但我們可以使用以下代碼對其進行縮放。
Picker(selection: .constant(1), label: Text("Picker")) {
Text("Hello").tag(1)
Text("World").tag(2)
}
.frame(height: 60)
.pickerStyle(SegmentedPickerStyle())
.scaledToFit()
.scaleEffect(CGSize(width: 1.5, height: 1.5))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.