Closed ivangodfather closed 9 years ago
Hi, you have to set the delegate and dataSource of the picker view controllers picker.
let pickerVC = RMPickerViewController(style: RMActionControllerStyle.White, selectAction: selectAction, andCancelAction: cancelAction);
pickerVC.picker.delegate = self;
pickerVC.picker.dataSource = self;
the picker view controller itself does not have a delegate or dataSource ;). Also in the demo project you have to make the ViewController implement the UIPickerViewDelegate and UIPickerViewDataSource protocol.
Wow my bad, maybe i rushed too much doing the demo, but i remembered not working previous version. Now seems its working fine. Ty a lot! By the way, to get the index of the selected row/s, this is "the standart" form?
let selectAction = RMAction(title: "Select", style: RMActionStyle.Done) { (actionController) -> Void in
let picker = (actionController as! RMPickerViewController).picker
let selectedRow = picker.selectedRowInComponent(0)
}
Unfortunately currently casting is neccessary. This will change with Xcode 7 and generics in Objective C. Until then we will just need to cast :/
Hi, i added a little project where i can't set the delegate of the RMPickerVC, can you have a look at it? Thx
http://ruiznadal.com/TestRMPicker.zip
Im making another example for the datepicker also