I was using pickerView didSelectRow
to save the selected value to NSUserDefaults and re populate my table view. However, at the point the action sheet / picker view is still visible and the user can select new values and didSelectRow will be called again.
EDIT: To clarify I don't want to populate my table view at this point.
I'm looking for an event when I can save the value and re-populate after the picker view is dismissed.
What can I use ?
Here's my code to show the action sheet / picker view.
- (IBAction)btnClicked:(id)sender {
NSString *title = UIDeviceOrientationIsLandscape([UIDevice currentDevice].
orientation) ? @"\n\n\n\n\n\n\n\n\n" : @"\n\n\n\n\n\n\n\n\n\n\n\n" ;
UIActionSheet *actionSheet = [[[[UIActionSheet alloc] init]
initWithTitle:[NSString stringWithFormat:@"%@%@",
title, NSLocalizedString(@"Select the recurrence", @"")] delegate:self
cancelButtonTitle:nil destructiveButtonTitle:nil
otherButtonTitles:@"OK", nil] autorelease];
[actionSheet showInView:self.view];
UIPickerView *pickerView = [[[UIPickerView alloc] init] autorelease];
pickerView.showsSelectionIndicator = YES;
pickerView.dataSource = self;
pickerView.delegate = self;
[actionSheet addSubview:pickerView];
}