Swift UI--轮子选取器,改变对齐方式和字体大小。

问题描述 投票:0回答:1

是否可以自定义轮子取款器的字体,并改变其排列方式。.leading?

ios swiftui picker
1个回答
0
投票

我想这将是你所期望的。

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()
    }
}

谢谢,X_X

© www.soinside.com 2019 - 2024. All rights reserved.