I'm having a weird bug with PickerView - I have three components in a PickerView, where the first component selects the main category, the second component selects the sub category, etc.
So, in my pickerView(..., numberOfRowsInComponent) function, I detect which row is selected in the first component using selectedRowInComponent(0), and then feed in the correct count of rows for the second component.
Some strange bug is occuring though... I've coded it so that if the first row (row 0) is selected on component 0, then the second and third components both have only 1 row each. But if component 0's second row is selected (row 1), there should be 5 rows in the second and third component.
In the viewOnLoad function of this corresponding view, I have it so I automatically select the second row of the pickerView's first component (using picker.selectRow()). This should mean that my second component will automatically appear with five rows. But instead, when I run my app, the second row is selected in component 0, but the second and third components only have 1 row each. It seems like it's bugging out and thinking that the first row is selected. Weird thing is that if I change the first component's row to something else and then back to row 1, it suddenly has the correct number of rows in components 1 and 2.
Hopefully this makes sense, hard to describe. Happy to post pictures if need be. Anyone know what I might be doing wrong?? Thanks!
Aucun commentaire:
Enregistrer un commentaire