picker

Row of Picker wheels in SwiftUI, why are drag-to-scroll areas offset from Picker controls on screen?

吃可爱长大的小学妹 提交于 2020-06-27 12:52:29
问题 I'm working on a SwiftUI view whose purpose is to allow the user to enter an amount of dollars. I want a row of seven wheel-style Pickers, each of whose values are the digits 0 to 9. The following code works, except that when I try to touch & drag a digit column to scroll through it, I find that my drag gesture causes not the Picker I'm touching to scroll, but rather a Picker several columns over to the right. To put it another way, the drag-to-scroll area for each Picker is offset quite a

swiftUi : 2 Pickers on one screen - app crash with “Index out of range”

妖精的绣舞 提交于 2020-06-22 13:08:29
问题 When I try to put 2 pikers with a different number of rows on-screen with different observers. if I select in one number of the row that not exists in the second, when I move to the second picker app crash with this message: "Fatal error: Index out of range" public enum kTrackType { case audio case text } class kTrack: NSObject, Identifiable { public var id = UUID() public var trakcId: String public var title: String public var type: kTrackType public init(id: String, title: String, type:

Xamarin forms set Picker SelectedItem

谁说我不能喝 提交于 2020-06-14 05:28:34
问题 I am working with a xamarin Forms. I am using Picker for DropDownList. How can I set selectedItem to Picker? My code <Picker x:Name="VendorName" Title="Select" ItemDisplayBinding="{Binding VendorName}" SelectedItem="{Binding VendorName}" Style="{StaticResource PickerStyle}"></Picker> and server side code is Device.BeginInvokeOnMainThread(() => { VendorName.ItemsSource = VendorList; }); var currentVendor = new List<Vendor>(); currentVendor.Add(new Vendor { VendorID = "111", VendorName = "aaaa"

Xamarin forms set Picker SelectedItem

余生颓废 提交于 2020-06-14 05:26:15
问题 I am working with a xamarin Forms. I am using Picker for DropDownList. How can I set selectedItem to Picker? My code <Picker x:Name="VendorName" Title="Select" ItemDisplayBinding="{Binding VendorName}" SelectedItem="{Binding VendorName}" Style="{StaticResource PickerStyle}"></Picker> and server side code is Device.BeginInvokeOnMainThread(() => { VendorName.ItemsSource = VendorList; }); var currentVendor = new List<Vendor>(); currentVendor.Add(new Vendor { VendorID = "111", VendorName = "aaaa"

Simple Android Directory picker - How?

拜拜、爱过 提交于 2020-05-24 21:13:05
问题 I have just started coding in Android Studio and feeling Awesome..!! How can I write a code for a 'Directory Picker'. i.e., When a button is clicked, a simple Dialog/Activity screen which can show list of directories. Also, want to store all the files in that directory in to an Array variable. (Once OK button is clicked). PS: I have searched here and found some cool 'File choose' but m looking for Directory Chooser..! Thanks in advance. 回答1: Try to use Intent.ACTION_OPEN_DOCUMENT_TREE if

How do I add action on picker on selection of item in swiftUI?

笑着哭i 提交于 2020-04-17 20:37:11
问题 I have a picker with certain list of items (say- Add, Edit, Delete) and on selection on particular item, I need to move to a different screen. I tried onTapGuesture() but control does not go inside when I debug the same. 回答1: I found 3 different ways to achieve this. The last one I took here. So, there are all these ways, you can choose which you want: struct PickerOnChange: View { private var options = ["add", "edit", "delete"] @State private var selectedOption = 0 @State private var choosed

How to change the change cancel and ok buttons' color in the picker?

非 Y 不嫁゛ 提交于 2020-04-16 05:59:05
问题 I'm using a custompicker in my app and I need to change the cancel and ok buttons' color. I recently changed the whole theme of timepicker and datepicker for android by adding this code to the style file: <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item> <item name="android:timePickerDialogTheme">@style/TimePickerTheme</item> item name="colorAccent">#039BE5</item> <item name="android:layout_width">wrap_content</item> <item name="android:layout_height">wrap_content<

Why Picker in SwiftUI works just one time

时光总嘲笑我的痴心妄想 提交于 2020-03-23 11:59:16
问题 I'm starting with SwiftUI and created this code struct ContentView: View { let countries = ["CZ","SK","DE"] @State private var country = 0 var body: some View { NavigationView { VStack { NavigationLink(destination: SettingsView()) { Text("Settings") } Form { Picker("Pick a country", selection: $country) { ForEach(0..<countries.count) { index in Text(self.countries[index]) } } Text(countries[country]) } } .navigationBarTitle("UNECE Data") } } } if I select value from the Picker it properly

Why Picker in SwiftUI works just one time

一曲冷凌霜 提交于 2020-03-23 11:58:25
问题 I'm starting with SwiftUI and created this code struct ContentView: View { let countries = ["CZ","SK","DE"] @State private var country = 0 var body: some View { NavigationView { VStack { NavigationLink(destination: SettingsView()) { Text("Settings") } Form { Picker("Pick a country", selection: $country) { ForEach(0..<countries.count) { index in Text(self.countries[index]) } } Text(countries[country]) } } .navigationBarTitle("UNECE Data") } } } if I select value from the Picker it properly

SwiftUI hierarchical Picker with dynamic data crashes [duplicate]

会有一股神秘感。 提交于 2020-03-10 05:08:39
问题 This question already has an answer here : swiftUi : 2 Pickers on one screen - app crash with “Index out of range” (1 answer) Closed last month . I just started working on SwiftUI and I have some difficulty to manage several Pickers with dynamic data. In that case there's two Pickers, for Country and City . When I try to switch the Picker from a country with more cities than the other, the app would crash : Fatal error: Index out of range Any idea how I could fix that ? App Screenshot import