How can you dynamically add values to UIPickerView at runtime.
I’m using the following code to populate a UIPickerView statically. Need to add values dynamically at run time, for e.g. Three, Four etc.
- (NSString *) pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ NSString *title = nil; if(row==0){ title = @'One'; } if(row==1){ title = @'Two'; }
If you had an array of the titles, you could use something like:
The titles will be refreshed when you call
[pickerView reloadAllComponents](orreloadComponent:if you have more than one column and only want to refresh one of them).