/ Published in: Objective C
1) Make sure the ViewController for the view implements the \< UIPickerViewDelegate, >
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)thePickerView { return 1; } - (NSInteger)pickerView:(UIPickerView *)thePickerView numberOfRowsInComponent:(NSInteger)component { return [foodTypes count]; } - (NSString *)pickerView:(UIPickerView *)thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { return [foodTypes objectAtIndex:row]; } - (void)pickerView:(UIPickerView *)thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { //NSLog(@"Selected Color: %@. Index of selected color: %i", [foodTypes objectAtIndex:row], row); }