Search Results

Search found 1 results on 1 pages for 'user1547180'.

Page 1/1 | 1 

  • UIPickerview filter list from a user previous textfield input

    - by user1547180
    int variabla; - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { if (variabla == 1) return list4.count; else if(variabla == 2) return list3.count; if (variabla == 3) return list1.count; if (variabla == 4) return list2.count; return YES; [pickerView reloadAllComponents]; } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { if (variabla == 1) { subjectField.text = [list4 objectAtIndex:row]; } else if (variabla == 2) { gradeField.text = [list3 objectAtIndex:row]; } else if (variabla == 3) { mathField.text = [list1 objectAtIndex:[pickerView selectedRowInComponent:0]]; selectedRow = [pickerView selectedRowInComponent:0]; coreTView.text = [mathMeaning objectAtIndex:selectedRow]; } if (variabla == 4) { elaField.text = [list2 objectAtIndex:[pickerView selectedRowInComponent:0]]; selectedRow = [pickerView selectedRowInComponent:0]; coreTView.text = [elaMeaning objectAtIndex:selectedRow]; } [pickerView reloadAllComponents]; NSLog(@"row selected is %d", selectedRow); } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if (variabla == 1) return [list4 objectAtIndex:row]; if (variabla == 2) return [list3 objectAtIndex:row]; if (variabla == 3) return [list1 objectAtIndex:row]; if (variabla == 4) return [list2 objectAtIndex:row]; return NO; [pickerView reloadAllComponents]; } Hey I would like to know or pointed in the right direction on how to load a UIPickerView based on the user input from a previous uitextfield so if they type in the previous textfield apple I would like red, green, blue to show in the UIPickerView or if they type orange I would like to see orange, yellow grape thanks for the help in advance.

    Read the article

1