UIPicker selectRow not working - what's wrong with this code?
It works if I put it in this method:
-(void) viewWillAppear: (BOOL) animated
You might need to call reloadAllComponents
after populating the array and before trying to select the row. The picker may not know your new number of elements yet.
Do following steps
- load array before picker initializing..
- call [pickerView selectRow:4 inComponent:0 animated:YES];
- call [pickerView reloadAllComponents];
In recent apple release notes apples says "In iOS 5.0 UIPickerView doesn’t send its pickerView:didSelectRow:inComponent: delegate message due to a programatic selection." So we need call relaodAppComponents forcefully..
Give acknowledge if its work...