I have a picker view
[picker selectRow:3 inComponent:0 animated:YES];
when i wrote this code in view did load,
This method is used to set the row 3 as default row in picker.
But i want that the row i have selected is set to be as default for the next time.
what to do? thanks in advance...
Try like this
NSUserDefaults *usrDefaults = [NSUserDefaults standardUserDefaults];
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
[usrDefaults setInteger:row forKey:@"Index"];
}
[pickerView selectRow:[[NSUserDefaults standardUserDefaults]integerForKey:@"Index"] inComponent:0 animated:NO];