Swift UI-转轮选取器,更改对齐方式和字体大小



是否可以自定义车轮拾取器字体并将对齐方式更改为.leading

我认为这将是您所期望的。

struct ContentView: View {
let colors = ["Red", "Yellow", "Green", "Gray", "Black", "Purple", "White", "Brown", "Pink", "Blue"]
@State private var color = "Red"
var body: some View {
Picker(selection: $color, label: Text("")) {
ForEach(self.colors, id: .self) { color in
HStack {
Text(color)
.font(.title)
.padding()
Spacer()
}
}
}
.pickerStyle(WheelPickerStyle())
.labelsHidden()
}
}

最新更新