How do I add multiple components to a PickerView?

前端 未结 5 761
北海茫月
北海茫月 2021-01-07 00:07

It may be a simple question but how do I add multiple components to a UIPickerView? I use NSMutableArray to populate one component but I dont know how to populate the others

5条回答
  •  生来不讨喜
    2021-01-07 00:30

    You need to set the datasource and use

    – numberOfComponentsInPickerView:
    – pickerView:numberOfRowsInComponent:
    

    set its delegate and use:

    – pickerView:didSelectRow:inComponent:
    

    to change your label when a certain row in a certain component is selected. Very likely to UITableViewDelegate and Datasource

    and also taking a glance to documentation helps :)

提交回复
热议问题