Skip to content
Roland Moers edited this page Oct 31, 2016 · 1 revision

Selecting a default value is rather easy. The UIPickerView is available through the picker property and can be used to select a default row. The following code gives an example on how to implement this.

Example

Objective-C

//Create select action
...

//Create picker view controller
RMPickerViewController *pickerController = [RMPickerViewController actionControllerWithStyle:style selectAction:selectAction andCancelAction:cancelAction];
pickerController.picker.delegate = self;
pickerController.picker.dataSource = self;

[pickerController.picker selectRow:<#some index#> inComponent:<#some component#> animated:NO];

//Now just present the picker controller using the standard iOS presentation method
[self presentViewController:pickerController animated:YES completion:nil];
Clone this wiki locally