Regarding implementation of multi component dependent uipickerview

后端 未结 1 1919
独厮守ぢ
独厮守ぢ 2021-01-20 22:18

I am having trouble grasping the concept of multi component uipickerviews. I really would like to just OWN this subject. I would like to make a 4 component pickerview with c

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-20 22:42

    It's quite simple. In the pickerView:didSelectRow:inComponent: method, just call [myPicker reloadComponent:] for all components coming after the one where the selection changed. The picker will then automatically ask its datasource (your view controller, presumably) for the number of rows and the rows' values.

    Then, in pickerView:numberOfRowsInComponent: and pickerView:titleForRow:forComponent:, return the appropriate values (the count and contents of the corresponding array) depending on the values of the parent components' selected rows.

    0 讨论(0)
提交回复
热议问题