class VC: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
var picker: UIPickerView!
let pickerValues = ["One", "Two", "Three"]
func pickerView(pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int{
return pickerValues.count
}
func numberOfComponentsInPickerView(pickerView: UIPickerView) -> Int{
return 1
}
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
return pickerValues[row]
}
func pickerView(pickerView: UIPickerView!, didSelectRow row: Int, inComponent component: Int){
textField.text = pickerValues[row]
}
func setUp() {
picker = UIPickerView()
picker.dataSource = self
picker.delegate = self
textField.inputView = picker
}
}