Belirli tercihler arasından seçim yapmaya yarar.
SwiftUI'ın şimdiki sürümünde SegmentedPickerStyleharicindeki stiller problemli gözüküyor. DefaultPickerStyle sadece Form içinde bulunurken çalışıyor. (Formun da NavigationView içinde olması gerekiyor.)
SegmentedPickerStyle
DefaultPickerStyle
Form
@State var options = (1...4).map { "Option - \($0)" } @State var selectedOption: String = "Option - 1" NavigationView { Form { Picker(selection: $selectedOption, label: Text("Select an option")) { ForEach(self.options, id: \.self) { Text($0) } }.pickerStyle(SegmentedPickerStyle()) Picker(selection: $selectedOption, label: Text("Select an option")) { ForEach(self.options, id: \.self) { Text($0) } }.pickerStyle(WheelPickerStyle()) Picker(selection: $selectedOption, label: Text("Select an option")) { ForEach(self.options, id: \.self) { Text($0) } }.pickerStyle(DefaultPickerStyle()) }.padding() }
Last updated 4 years ago
Was this helpful?