I have picker view with two components. Second component has data like "Farenheit(F)","Celcius(C)" and First component have values of F and C. I want to reload the First component with different data according to the value selected. Second component like F & C. So my question is "is it possible?" if yes then please reply with example or "how to do it?".
I found the answer to my own question.
The way to accomplish this is below -- also, remember to call this code in the numberOfRowsInComponent:
method.
In the titleForRow:
method:
if (component == kTitleComponent)
{
return [titleArray objectAtIndex:row];
}
else
{
switch([pickerViewForThermo selectedRowInComponent:1]) // here you set content of component two depending on which row is selected from component 1
{
case 0: // remember index starts at 0
return [farenheitArray objectAtIndex:row];
break;
case 1:
return [celciusArray objectAtIndex:row];
break;
//... and so on for each row in the component 1 (with index 0)
}
}