Closed boazFrenkel closed 9 years ago
Depends on what you want. If you want use multiple pickers at different times, you may use the solution @vincentvillalta provided (using tags).
If you want to show multiple pickers at the same time, tell me ;). Currently I'm working on a new version of RMDateSelectionViewController (see branch MoreButtons).Originally, in this version I wanted to use a UIAlertController-like interface to add custom defined buttons to RMDateSelectionViewController. But at the moment I'm thinking of unifying RMDateSelectionViewController and RMPickerViewController by enabling the user to add custom views instead of only custom buttons.
Closing due to missing response...
Maybe this helps, im using several pickers and using tags to provide the numberOfRows and titleForRow methods
Something like this:
(IBAction)showPickerOne:(id)sender { RMPickerViewController *pickerVC = [RMPickerViewController pickerController]; pickerVC.picker.tag = 10; pickerVC.picker.delegate = self; pickerVC.picker.dataSource = self;
//Set a title for the picker pickerVC.titleLabel.text = @"This is an example title.\n\nPlease choose a row and press 'Select' or 'Cancel'.";
//Set select and (optional) cancel blocks [pickerVC setSelectButtonAction:^(RMPickerViewController controller, NSArray rows) { NSLog(@"Successfully selected rows: %@", rows); }];
[pickerVC setCancelButtonAction:^(RMPickerViewController *controller) { NSLog(@"Row selection was canceled"); }];
[self presentViewController:pickerVC animated:YES completion:nil]; }
(IBAction)showPickerTwo:(id)sender { RMPickerViewController *pickerVC = [RMPickerViewController pickerController]; pickerVC.picker.tag = 10; pickerVC.picker.delegate = self; pickerVC.picker.dataSource = self;
//Set a title for the picker pickerVC.titleLabel.text = @"This is an example title.\n\nPlease choose a row and press 'Select' or 'Cancel'.";
//Set select and (optional) cancel blocks [pickerVC setSelectButtonAction:^(RMPickerViewController controller, NSArray rows) { NSLog(@"Successfully selected rows: %@", rows); }];
[pickerVC setCancelButtonAction:^(RMPickerViewController *controller) { NSLog(@"Row selection was canceled"); }];
[self presentViewController:pickerVC animated:YES completion:nil]; }
// UIPickerViewDelegates