i am trying to assign my pickerview data but what data type member is picker view?
when i use text it says the error "value of type uipickerview has no member text"
dateLabel.text = shiftItem.day
timing.text = shiftItem.slot
the ibaction is
@IBOutlet weak var timing: UIPickerView!
so for label or text field the data type would be text but what is it for pickerview?
this may seem like a dumb question but i could not find the answer anywhere
also, how can i pass the data a user has selected on a pickerview to another view controller?
thank you so much for all the help!
3
Answers
UIPickerView
doesn’t have any property namedtext
. You have to use an array of String as it’s datasource. Here is an example.func pickerView(pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
// use the row to get the selected row from the picker view
// using the row extract the value from your datasource (array[row])
}
Please use the below code for it. Picker View doesn’t have a text member.