tags:

views:

15

answers:

1

I have a UIPickerview with three components and three lengthy arrays to populate them. However, I want to selectively populate each component depending on the values selected in previous components e.g. -

if component 1 has a value of 4, then component 2 will get populated with the elements 20-40 of its array. And if component 2 has a selected value of 22, then component 3 will be populated by elements 30-45 of its array.

I want to be able to populate a component with a range of elements from an array, not all of them. Then I want to reload the components accordingly. I don't know how/where in the ObjectAtIndex:row statement achieve this. Can someone advise me please.

A: 
  1. Implement the method – pickerView:didSelectRow:inComponent: and change the content of the dataSource according to the selected item.

  2. Just refresh the PickerView with [yourPickerView reloadAllComponents]; each time a selection has been made

Good luck!

dkk