I want to use UIPickerView with 2 components, in which the second component value will be dependent on the first component value, like if in the first component Group 1 is selected then in the second component the group 1 values should be shown.
After selecting the values from both components value will be assigned to a UITextField or UILabel and the picker will be hidden.
(I have a main view in which I have added a subview to add the UIPickerView).
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
return 2;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
if (component==0)
{
return [vGroup count];
}
else
{
return [vehiclePickerList count];
}
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
switch (component)
{
case 0:
return [vGroup objectAtIndex:row];
break;
case 1:
return [vehiclePickerList objectAtIndex:row];
break;
}
return nil;
}
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)