picker

SwiftUI hierarchical Picker with dynamic data crashes [duplicate]

别说谁变了你拦得住时间么 提交于 2020-03-10 05:07:43
问题 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

SwiftUI hierarchical Picker with dynamic data crashes [duplicate]

爱⌒轻易说出口 提交于 2020-03-10 05:07:42
问题 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

How to display Picker.Item label with Dynamic values in array in react native

南楼画角 提交于 2020-03-05 03:39:59
问题 how can I pick 'label' of 'Picker.Item' from an array. i have my picker code as follows: <View style={Styles.inputWrapper}> <Picker selectedValue={this.state.expiryYear} style={Styles.expYear} onValueChange={(itemValue, itemIndex) => this.setState({ expiryYear: itemValue })}> <Picker.Item label="select" value="0" /> <Picker.Item label="2018" value="2018" /> <Picker.Item label="2019" value="2019" /> <Picker.Item label="2020" value="2020" /> <Picker.Item label="2021" value="2021" /> . . .

SwiftUI How to add done button to picker

我们两清 提交于 2020-03-03 21:46:32
问题 Ive make a mini app with just a button and a picker and the idea is to have a done button above the picker so once ive chosen a value i can press done and the picker will close. I am aware if you click the "click me" button it will open and if you click it again close the picker but im looking for a button that appears with the picker and disapears with the clicker when clicked. Almost like a toolbar above the picker with a done button @State var expand = false @State var list = ["value1",

React Native ArrayIndexOutOfBoundsException

[亡魂溺海] 提交于 2020-02-25 04:15:28
问题 I am using Picker component from React Native. I have two Picker components: State ( stateList() function ) City ( cityList() function ) I am calling two APIs: apiState() function : it loads the list of State apiCity(state_identification) function : based on the State selected, this function will display a list of City ( code snippet provided below ) Code Snippet : constructor(props) { super(props); this.state = { pickerValueState: null, dataState: [], pickerValueCity: null, dataCity: [],

React Native ArrayIndexOutOfBoundsException

北城以北 提交于 2020-02-25 04:14:06
问题 I am using Picker component from React Native. I have two Picker components: State ( stateList() function ) City ( cityList() function ) I am calling two APIs: apiState() function : it loads the list of State apiCity(state_identification) function : based on the State selected, this function will display a list of City ( code snippet provided below ) Code Snippet : constructor(props) { super(props); this.state = { pickerValueState: null, dataState: [], pickerValueCity: null, dataCity: [],

Why is SwiftUI picker in form repositioning after navigation?

坚强是说给别人听的谎言 提交于 2020-02-13 00:09:26
问题 After clicking the picker it navigates to the select view. The item list is rendered too far from the top, but snaps up after the animation is finished. Why is this happening? Demo: https://gfycat.com/idioticdizzyazurevase I already created a minimal example to rule out navigation bar titles and buttons, form sections and other details: import SwiftUI struct NewProjectView: View { @State var name = "" var body: some View { NavigationView { Form { Picker("Client", selection: $name) { Text(

Swift/iOS : UIPicker display is not refreshed until tapped after changing the datasource programmatically

蹲街弑〆低调 提交于 2020-01-17 07:00:17
问题 In my app, I have a picker that's filled with data from my server after a POST request. It has one element initially (used as a label), and when the POST request is filled the datasource get changed and I call picker.reloadAllComponents() to refresh it. When this run, nothing appears to happen on screen, the picker doesn't change. But once tapped, the new data instantly appear and it works correctly. Seems like the data source change works correctly but the display doesn't change until

Add font family and font size in UIPickerView

只愿长相守 提交于 2020-01-06 12:46:08
问题 I'm a newbie to iOS programming, I have a project and my requirements are 1: I have to add font family 2: In the same way, I have to add font size These are to be added with a done button on top and a bifurcation in between them. Guys I have searched and cant get it, kindly help me out. Thanks in advance. 回答1: Your picker view should have two components. The number of rows in the first component should be the count of the items in your font family list. The number of rows in the second

Wheel Pickers in form disappear after some show/hide cycles

[亡魂溺海] 提交于 2020-01-05 04:09:12
问题 I'm experiencing a strange behavior with wheel pickers embedded in a conditional subview. When the subview is shown, sometimes the values are not shown. Switching around between two conditional views, the values sometimes reappear. I've attached an animation showing the behavior and the full code. I can't find the reason for this. Update: I've tried a lot of things to find the reason for this. Even after simplifying the revealing subform to just one single picker, replacing the foreach loop